Decompiled source of TalentTree v2.3.5

TalentTree.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using Balance;
using BepInEx;
using BepInEx.Configuration;
using Core;
using HarmonyLib;
using Integration;
using JetBrains.Annotations;
using Jotunn;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq.JsonPath;
using Newtonsoft.Json.Schema;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Utilities;
using Patches;
using SkillsReworked.Api;
using SkillsReworked.Systems.Prestige;
using SkillsReworked.Systems.Rebirth;
using SkillsReworked.Systems.Rewards;
using TMPro;
using Talents;
using Talents.Berserker;
using Talents.Berserker.Effects;
using Talents.Berserker.Patches;
using Talents.Bulwark;
using Talents.Bulwark.Effects;
using Talents.Hunter;
using Talents.Hunter.Effects;
using Talents.Shared;
using Talents.Valkyrie;
using Talents.Warcaller;
using Talents.Warcaller.Effects;
using Talents.Warcaller.Patches;
using Talents.Warrior;
using Talents.Warrior.Effects;
using Talents.Warrior.Patches;
using UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("assembly_guiutils")]
[assembly: IgnoresAccessChecksTo("assembly_utils")]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("TalentTree")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+dbc3037c3e3967af0784da3edcfe88fad5fed191")]
[assembly: AssemblyProduct("TalentTree")]
[assembly: AssemblyTitle("TalentTree")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UI
{
	internal static class TalentWindowFooterBuilder
	{
		internal sealed class Result
		{
			public Button ApplyButton;

			public Text ApplyBtnLabel;

			public Button ResetButton;

			public Text ResetBtnLabel;
		}

		public static Result Build(Transform panel, TalentUiLayout layout)
		{
			//IL_0018: 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_0063: 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)
			Result result = new Result();
			var (val, applyButton, applyBtnLabel) = UiFactory.CreateButtonBottomCenter(panel, "ApplyButton", JotunnLocalization.T("tt_ui_apply"), layout.ApplyButtonOffset, layout.ApplyButtonSize);
			val.SetActive(false);
			result.ApplyButton = applyButton;
			result.ApplyBtnLabel = applyBtnLabel;
			var (val2, resetButton, resetBtnLabel) = UiFactory.CreateButtonBottomCenter(panel, "ResetButton", JotunnLocalization.T("tt_ui_reset_draft"), layout.ResetButtonOffset, layout.ResetButtonSize);
			val2.SetActive(false);
			result.ResetButton = resetButton;
			result.ResetBtnLabel = resetBtnLabel;
			return result;
		}
	}
	internal static class TalentWindowHeaderBuilder
	{
		internal sealed class Result
		{
			public Text TitleText;

			public Text PointsText;

			public Button CloseButton;

			public Button StatsButton;

			public Text StatsBtnLabel;
		}

		public static Result Build(Transform panel, TalentUiLayout layout)
		{
			//IL_0018: 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_0038: 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_0070: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			Result result = new Result();
			var (val, val2) = UiFactory.CreateTextTopCenter(panel, "Title", JotunnLocalization.T("tt_ui_talents_title"), layout.TitleOffset, layout.TitleSize, GUIManager.Instance.NorseBold, layout.TitleFontSize, GUIManager.Instance.ValheimOrange, outline: true, Color.black);
			val2.alignment = (TextAnchor)4;
			result.TitleText = val2;
			Button item = UiFactory.CreateButtonTopRight(panel, "CloseButton", "X", layout.CloseButtonOffset, layout.CloseButtonSize).button;
			result.CloseButton = item;
			Text item2 = UiFactory.CreateNumberToken(panel, "Points", UiFactory.Presets.TopLeft, layout.PointsTokenOffset, layout.PointsTokenSize, GUIManager.Instance.ValheimOrange, GUIManager.Instance.AveriaSerifBold, layout.PointsTokenFontSize, Color.white).number;
			item2.text = "0";
			result.PointsText = item2;
			(GameObject go, Button button, Text label) tuple2 = UiFactory.CreateButtonTopLeft(panel, "StatsButton", JotunnLocalization.T("tt_ui_stats"), layout.StatsButtonOffset, layout.StatsButtonSize);
			Button item3 = tuple2.button;
			Text item4 = tuple2.label;
			result.StatsButton = item3;
			result.StatsBtnLabel = item4;
			return result;
		}
	}
	internal static class TalentWindowSearchBuilder
	{
		internal sealed class Result
		{
			public InputField SearchInput;

			public RectTransform SearchInputRt;

			public GameObject SearchDropdown;

			public RectTransform SearchDropdownRt;
		}

		public static Result Build(Transform panel, TalentUiLayout layout, TalentUiTheme theme)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Expected O, but got Unknown
			Result result = new Result();
			GameObject val = new GameObject("SearchBox", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(InputField)
			});
			val.transform.SetParent(panel, false);
			result.SearchInputRt = (RectTransform)val.transform;
			UiFactory.SetTopRight(result.SearchInputRt, layout.SearchOffset, layout.SearchSize);
			Image component = val.GetComponent<Image>();
			component.sprite = GUIManager.Instance.GetSprite("text_field");
			component.type = (Type)1;
			((Graphic)component).color = theme.SearchBoxBackground;
			((Graphic)component).raycastTarget = true;
			result.SearchInput = val.GetComponent<InputField>();
			result.SearchInput.lineType = (LineType)0;
			result.SearchInput.characterLimit = layout.SearchCharacterLimit;
			RectTransform val2 = UiFactory.CreateRect("Text", val.transform);
			UiFactory.SetRectStretch(val2, new Vector2(layout.SearchTextPaddingX, layout.SearchTextPaddingY), new Vector2(0f - layout.SearchTextPaddingX, 0f - layout.SearchTextPaddingY));
			Text val3 = ((Component)val2).gameObject.AddComponent<Text>();
			val3.text = "";
			val3.font = GUIManager.Instance.AveriaSerifBold;
			val3.fontSize = layout.SearchFontSize;
			((Graphic)val3).color = Color.white;
			val3.alignment = (TextAnchor)3;
			val3.supportRichText = false;
			result.SearchInput.textComponent = val3;
			RectTransform val4 = UiFactory.CreateRect("Placeholder", val.transform);
			UiFactory.SetRectStretch(val4, val2.offsetMin, val2.offsetMax);
			Text val5 = ((Component)val4).gameObject.AddComponent<Text>();
			val5.text = JotunnLocalization.T("tt_ui_search_placeholder");
			val5.font = GUIManager.Instance.AveriaSerifBold;
			val5.fontSize = layout.SearchFontSize;
			((Graphic)val5).color = theme.SearchPlaceholderColor;
			val5.alignment = (TextAnchor)3;
			((Graphic)val5).raycastTarget = false;
			result.SearchInput.placeholder = (Graphic)(object)val5;
			result.SearchDropdown = new GameObject("SearchDropdown", new Type[4]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(VerticalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			result.SearchDropdown.transform.SetParent(panel, false);
			result.SearchDropdownRt = (RectTransform)result.SearchDropdown.transform;
			UiFactory.SetTopRight(result.SearchDropdownRt, new Vector2(result.SearchInputRt.anchoredPosition.x, result.SearchInputRt.anchoredPosition.y - result.SearchInputRt.sizeDelta.y - layout.SearchDropdownGap), new Vector2(result.SearchInputRt.sizeDelta.x, layout.SearchDropdownInitialHeight));
			Image component2 = result.SearchDropdown.GetComponent<Image>();
			component2.sprite = GUIManager.Instance.GetSprite("text_field");
			component2.type = (Type)1;
			((Graphic)component2).color = theme.SearchDropdownBackground;
			((Graphic)component2).raycastTarget = true;
			VerticalLayoutGroup component3 = result.SearchDropdown.GetComponent<VerticalLayoutGroup>();
			((LayoutGroup)component3).padding = new RectOffset(layout.SearchDropdownPadding, layout.SearchDropdownPadding, layout.SearchDropdownPadding, layout.SearchDropdownPadding);
			((HorizontalOrVerticalLayoutGroup)component3).spacing = layout.SearchDropdownSpacing;
			((HorizontalOrVerticalLayoutGroup)component3).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)component3).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)component3).childForceExpandWidth = true;
			((LayoutGroup)component3).childAlignment = (TextAnchor)0;
			ContentSizeFitter component4 = result.SearchDropdown.GetComponent<ContentSizeFitter>();
			component4.horizontalFit = (FitMode)0;
			component4.verticalFit = (FitMode)2;
			result.SearchDropdown.SetActive(false);
			return result;
		}
	}
	internal static class TalentWindowTreeAreaBuilder
	{
		internal sealed class Result
		{
			public ScrollRect ScrollRect;

			public RectTransform ViewportRt;

			public RectTransform ContentRt;

			public RectTransform WorldRt;

			public RectTransform PathsRootRt;

			public RectTransform NodesRootRt;

			public MouseWheelZoomToCursor Zoom;
		}

		public static Result Build(Transform panel, TalentUiLayout layout, TalentUiTheme theme)
		{
			//IL_0015: 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_004a: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00ec: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			Result result = new Result();
			RectTransform val = UiFactory.CreateRect("TalentTree_Area", panel);
			UiFactory.SetRectStretch(val, layout.TreeAreaPaddingMin, layout.TreeAreaPaddingMax);
			Image val2 = ((Component)val).gameObject.AddComponent<Image>();
			val2.sprite = GUIManager.Instance.GetSprite("Background");
			((Graphic)val2).color = theme.TreeBackground;
			((Graphic)val2).raycastTarget = true;
			result.ViewportRt = UiFactory.CreateRect("Viewport", (Transform)(object)val);
			UiFactory.SetRectStretch(result.ViewportRt, layout.ViewportPaddingMin, layout.ViewportPaddingMax);
			((Graphic)((Component)result.ViewportRt).gameObject.AddComponent<Image>()).color = theme.ViewportMaskTint;
			((Component)result.ViewportRt).gameObject.AddComponent<Mask>().showMaskGraphic = false;
			result.ContentRt = UiFactory.CreateRect("Content", (Transform)(object)result.ViewportRt);
			UiFactory.SetCenter(result.ContentRt, Vector2.zero, layout.ContentSize);
			((Transform)result.ContentRt).localScale = Vector3.one;
			result.WorldRt = UiFactory.CreateRect("World", (Transform)(object)result.ContentRt);
			UiFactory.SetCenter(result.WorldRt, Vector2.zero, result.ContentRt.sizeDelta);
			result.PathsRootRt = UiFactory.CreateRect("PathsRoot", (Transform)(object)result.WorldRt);
			result.NodesRootRt = UiFactory.CreateRect("NodesRoot", (Transform)(object)result.WorldRt);
			UiFactory.SetRectStretch(result.PathsRootRt, Vector2.zero, Vector2.zero);
			UiFactory.SetRectStretch(result.NodesRootRt, Vector2.zero, Vector2.zero);
			((Component)result.PathsRootRt).transform.SetAsFirstSibling();
			((Component)result.NodesRootRt).transform.SetAsLastSibling();
			result.ScrollRect = ((Component)val).gameObject.AddComponent<ScrollRect>();
			result.ScrollRect.viewport = result.ViewportRt;
			result.ScrollRect.content = result.ContentRt;
			result.ScrollRect.horizontal = true;
			result.ScrollRect.vertical = true;
			result.ScrollRect.movementType = (MovementType)2;
			result.ScrollRect.inertia = true;
			result.ScrollRect.scrollSensitivity = 0f;
			result.Zoom = ((Component)result.ViewportRt).gameObject.AddComponent<MouseWheelZoomToCursor>();
			result.Zoom.Initialize(result.ViewportRt, result.ContentRt, result.ScrollRect, layout);
			return result;
		}
	}
	internal sealed class TalentSearchController
	{
		private sealed class SearchItem
		{
			public string Id;

			public string Name;

			public string IdLower;

			public string NameLower;

			public string HaystackLower;
		}

		private struct SearchMatch
		{
			public SearchItem Item;

			public int Score;
		}

		private sealed class SuggestionEntry
		{
			public GameObject Go;

			public Button Button;

			public Image Background;

			public Text Label;

			public string Id;
		}

		private sealed class SuggestionPointerDownCatcher : MonoBehaviour, IPointerDownHandler, IEventSystemHandler
		{
			public TalentSearchController Owner;

			public int Index;

			public void OnPointerDown(PointerEventData eventData)
			{
				Owner._suppressEndEditOnce = true;
				Owner.SelectByIndex(Index);
			}
		}

		private const int DefaultIndexCapacity = 256;

		private const int DefaultMatchBufferCapacity = 256;

		private const int DefaultSuggestionsCapacity = 16;

		private const int ScorePrefixNameBase = 1000;

		private const int ScoreContainsNameBase = 800;

		private const int ScorePrefixIdBase = 600;

		private const int ScoreContainsIdBase = 400;

		private const int ScoreContainsHaystackBase = 200;

		private readonly TalentUiTheme _theme;

		private readonly TalentUiLayout _layout;

		private readonly List<SearchItem> _index = new List<SearchItem>(256);

		private readonly List<SearchMatch> _matchBuffer = new List<SearchMatch>(256);

		private readonly List<SuggestionEntry> _suggestions = new List<SuggestionEntry>(16);

		private readonly InputField _input;

		private readonly RectTransform _inputRt;

		private readonly GameObject _dropdown;

		private readonly RectTransform _dropdownRt;

		private bool _suppressSearchEvents;

		private bool _suppressEndEditOnce;

		private bool _selecting;

		private bool _pendingHide;

		private int _selectedSuggestionIndex = -1;

		private readonly List<SearchItem> _browse = new List<SearchItem>(256);

		private bool _browsing;

		private int _browseOffset;

		private Func<TalentDefinition, string> _displayName;

		private Action<string> _onSelected;

		public bool IsDropdownVisible => (Object)(object)_dropdown != (Object)null && _dropdown.activeSelf;

		public TalentSearchController(InputField input, RectTransform inputRt, GameObject dropdown, RectTransform dropdownRt, TalentUiTheme theme = null, TalentUiLayout layout = null)
		{
			_input = input;
			_inputRt = inputRt;
			_dropdown = dropdown;
			_dropdownRt = dropdownRt;
			_theme = theme ?? TalentUiTheme.Default;
			_layout = layout ?? TalentUiLayout.Default;
		}

		public void Bind(Func<TalentDefinition, string> displayName, Action<string> onSelected)
		{
			_displayName = displayName;
			_onSelected = onSelected;
			((UnityEventBase)_input.onValueChanged).RemoveAllListeners();
			((UnityEventBase)_input.onEndEdit).RemoveAllListeners();
			((UnityEvent<string>)(object)_input.onValueChanged).AddListener((UnityAction<string>)OnSearchChanged);
			((UnityEvent<string>)(object)_input.onEndEdit).AddListener((UnityAction<string>)OnSearchEndEdit);
		}

		public void RebuildIndex(IEnumerable<TalentDefinition> defs)
		{
			_index.Clear();
			foreach (TalentDefinition def in defs)
			{
				if (def != null && def.Tier != NodeTier.Minor)
				{
					string text = def.Id ?? "";
					string text2 = ((_displayName != null) ? _displayName(def) : (def.NameKey ?? text));
					string text3 = text.ToLowerInvariant();
					string text4 = (text2 ?? "").ToLowerInvariant();
					_index.Add(new SearchItem
					{
						Id = text,
						Name = text2,
						IdLower = text3,
						NameLower = text4,
						HaystackLower = text3 + " " + text4
					});
				}
			}
		}

		public void Clear()
		{
			_suppressSearchEvents = true;
			try
			{
				_input.text = "";
			}
			finally
			{
				_suppressSearchEvents = false;
			}
			HideDropdown();
		}

		public void HideDropdown()
		{
			_pendingHide = false;
			if ((Object)(object)_dropdown != (Object)null)
			{
				_dropdown.SetActive(false);
			}
			_selectedSuggestionIndex = -1;
			_browsing = false;
		}

		public void TickGamepad()
		{
			if ((Object)(object)_input == (Object)null || (Object)(object)_dropdown == (Object)null)
			{
				return;
			}
			if (!_browsing)
			{
				if (ZInput.GetButtonDown("JoyLStick"))
				{
					OpenBrowse();
				}
				return;
			}
			int num = Mathf.Max(1, GetVisibleSuggestionCount());
			if (ZInput.GetButtonDown("JoyDPadDown") || ZInput.GetButtonDown("JoyLStickDown"))
			{
				MoveBrowse(1);
			}
			else if (ZInput.GetButtonDown("JoyDPadUp") || ZInput.GetButtonDown("JoyLStickUp"))
			{
				MoveBrowse(-1);
			}
			else if (ZInput.GetButtonDown("JoyTabRight"))
			{
				MoveBrowse(num);
			}
			else if (ZInput.GetButtonDown("JoyTabLeft"))
			{
				MoveBrowse(-num);
			}
			else if (ZInput.GetButtonDown("JoyButtonA"))
			{
				ZInput.ResetButtonStatus("JoyButtonA");
				TrySelectCurrentSuggestion();
			}
		}

		private void OpenBrowse()
		{
			_browse.Clear();
			_browse.AddRange(_index);
			_browse.Sort((SearchItem a, SearchItem b) => string.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase));
			if (_browse.Count != 0)
			{
				_browsing = true;
				_browseOffset = 0;
				_selectedSuggestionIndex = 0;
				ShowBrowseRows();
				AlignDropdown();
				_dropdown.SetActive(true);
			}
		}

		private void MoveBrowse(int step)
		{
			int visibleSuggestionCount = GetVisibleSuggestionCount();
			if (visibleSuggestionCount == 0)
			{
				return;
			}
			int num = _browseOffset + Mathf.Clamp(_selectedSuggestionIndex, 0, visibleSuggestionCount - 1);
			int num2 = Mathf.Clamp(num + step, 0, _browse.Count - 1);
			if (num2 != num)
			{
				if (num2 < _browseOffset)
				{
					_browseOffset = num2;
				}
				else if (num2 >= _browseOffset + visibleSuggestionCount)
				{
					_browseOffset = num2 - visibleSuggestionCount + 1;
				}
				_selectedSuggestionIndex = num2 - _browseOffset;
				ShowBrowseRows();
				if ((Object)(object)GamepadRumble.instance != (Object)null)
				{
					GamepadRumble.instance.PlayGlobalSelectVibration();
				}
			}
		}

		private void ShowBrowseRows()
		{
			int num = Mathf.Min(_layout.SearchMaxSuggestions, _browse.Count);
			EnsureSuggestionEntries(num);
			for (int i = 0; i < _suggestions.Count; i++)
			{
				SuggestionEntry suggestionEntry = _suggestions[i];
				bool flag = i < num;
				if (flag)
				{
					SearchItem searchItem = _browse[_browseOffset + i];
					suggestionEntry.Id = searchItem.Id;
					suggestionEntry.Label.text = searchItem.Name;
				}
				suggestionEntry.Go.SetActive(flag);
			}
			ApplySuggestionHighlight();
		}

		private void AlignDropdown()
		{
			//IL_0030: 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_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)
			if (!((Object)(object)_dropdownRt == (Object)null) && !((Object)(object)_inputRt == (Object)null))
			{
				_dropdownRt.anchoredPosition = new Vector2(_inputRt.anchoredPosition.x, _inputRt.anchoredPosition.y - _inputRt.sizeDelta.y - _layout.SearchDropdownGap);
			}
		}

		public void Tick()
		{
			if ((Object)(object)_input == (Object)null || (Object)(object)_dropdown == (Object)null)
			{
				return;
			}
			if (_pendingHide)
			{
				_pendingHide = false;
				if (!_selecting)
				{
					HideDropdown();
				}
			}
			else if (_dropdown.activeSelf && _input.isFocused)
			{
				if (ZInput.GetKeyDown((KeyCode)274, true))
				{
					_selectedSuggestionIndex = Mathf.Clamp(_selectedSuggestionIndex + 1, 0, GetVisibleSuggestionCount() - 1);
					ApplySuggestionHighlight();
				}
				else if (ZInput.GetKeyDown((KeyCode)273, true))
				{
					_selectedSuggestionIndex = Mathf.Clamp(_selectedSuggestionIndex - 1, 0, GetVisibleSuggestionCount() - 1);
					ApplySuggestionHighlight();
				}
				else if (IsSubmitKeyDown())
				{
					TrySelectCurrentSuggestion();
				}
				else if (ZInput.GetKeyDown((KeyCode)27, true))
				{
					HideDropdown();
					_input.DeactivateInputField();
				}
			}
		}

		private void OnSearchEndEdit(string value)
		{
			if (!_selecting)
			{
				if (_suppressEndEditOnce)
				{
					_suppressEndEditOnce = false;
				}
				else if (!IsSubmitKeyDown() || !TrySelectCurrentSuggestion())
				{
					_pendingHide = true;
				}
			}
		}

		private void OnSearchChanged(string raw)
		{
			if (!_suppressSearchEvents && !_selecting)
			{
				if (string.IsNullOrWhiteSpace(raw))
				{
					HideDropdown();
				}
				else
				{
					UpdateSuggestions(raw);
				}
			}
		}

		private void UpdateSuggestions(string raw)
		{
			_matchBuffer.Clear();
			string text = raw.Trim().ToLowerInvariant();
			if (text.Length == 0)
			{
				HideDropdown();
				return;
			}
			for (int i = 0; i < _index.Count; i++)
			{
				SearchItem item = _index[i];
				int num = ScoreMatch(item, text);
				if (num > 0)
				{
					_matchBuffer.Add(new SearchMatch
					{
						Item = item,
						Score = num
					});
				}
			}
			if (_matchBuffer.Count == 0)
			{
				HideDropdown();
				return;
			}
			_matchBuffer.Sort((SearchMatch a, SearchMatch b) => b.Score.CompareTo(a.Score));
			int num2 = Mathf.Min(_layout.SearchMaxSuggestions, _matchBuffer.Count);
			EnsureSuggestionEntries(num2);
			for (int num3 = 0; num3 < num2; num3++)
			{
				SearchMatch searchMatch = _matchBuffer[num3];
				SuggestionEntry suggestionEntry = _suggestions[num3];
				suggestionEntry.Id = searchMatch.Item.Id;
				suggestionEntry.Label.text = searchMatch.Item.Name;
				suggestionEntry.Go.SetActive(true);
			}
			for (int num4 = num2; num4 < _suggestions.Count; num4++)
			{
				_suggestions[num4].Go.SetActive(false);
			}
			_browsing = false;
			_selectedSuggestionIndex = 0;
			ApplySuggestionHighlight();
			AlignDropdown();
			_dropdown.SetActive(true);
		}

		private int ScoreMatch(SearchItem item, string q)
		{
			if (item.NameLower.StartsWith(q))
			{
				return 1000 - item.NameLower.Length;
			}
			if (item.NameLower.Contains(q))
			{
				return 800 - item.NameLower.Length;
			}
			if (item.IdLower.StartsWith(q))
			{
				return 600 - item.IdLower.Length;
			}
			if (item.IdLower.Contains(q))
			{
				return 400 - item.IdLower.Length;
			}
			if (item.HaystackLower.Contains(q))
			{
				return 200 - item.HaystackLower.Length;
			}
			return 0;
		}

		private int GetVisibleSuggestionCount()
		{
			int num = 0;
			for (int i = 0; i < _suggestions.Count; i++)
			{
				if (_suggestions[i].Go.activeSelf)
				{
					num++;
				}
			}
			return num;
		}

		private void ApplySuggestionHighlight()
		{
			//IL_005f: 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)
			for (int i = 0; i < _suggestions.Count; i++)
			{
				SuggestionEntry suggestionEntry = _suggestions[i];
				if (suggestionEntry.Go.activeSelf)
				{
					bool flag = i == _selectedSuggestionIndex;
					if ((Object)(object)suggestionEntry.Background != (Object)null)
					{
						((Graphic)suggestionEntry.Background).color = (flag ? _theme.SuggestionSelected : _theme.SuggestionNormal);
					}
				}
			}
		}

		private void EnsureSuggestionEntries(int count)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0146: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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)
			while (_suggestions.Count < count)
			{
				int count2 = _suggestions.Count;
				GameObject val = new GameObject($"Row_{count2}", new Type[3]
				{
					typeof(RectTransform),
					typeof(Image),
					typeof(LayoutElement)
				});
				val.transform.SetParent(_dropdown.transform, false);
				RectTransform val2 = (RectTransform)val.transform;
				val2.sizeDelta = new Vector2(0f, _layout.SuggestionRowHeight);
				LayoutElement component = val.GetComponent<LayoutElement>();
				component.minHeight = _layout.SuggestionRowHeight;
				component.preferredHeight = _layout.SuggestionRowHeight;
				component.flexibleHeight = 0f;
				Image component2 = val.GetComponent<Image>();
				((Graphic)component2).color = _theme.SuggestionNormal;
				((Graphic)component2).raycastTarget = true;
				Button val3 = val.AddComponent<Button>();
				((Selectable)val3).transition = (Transition)0;
				SuggestionPointerDownCatcher suggestionPointerDownCatcher = val.AddComponent<SuggestionPointerDownCatcher>();
				suggestionPointerDownCatcher.Owner = this;
				suggestionPointerDownCatcher.Index = count2;
				GameObject val4 = new GameObject("Label", new Type[2]
				{
					typeof(RectTransform),
					typeof(Text)
				});
				val4.transform.SetParent(val.transform, false);
				RectTransform rt = (RectTransform)val4.transform;
				UiFactory.SetRectStretch(rt, new Vector2(_layout.SuggestionLabelPaddingX, 0f), new Vector2(0f - _layout.SuggestionLabelPaddingX, 0f));
				Text component3 = val4.GetComponent<Text>();
				component3.text = "";
				component3.font = GUIManager.Instance.AveriaSerifBold;
				component3.fontSize = _layout.SuggestionFontSize;
				((Graphic)component3).color = Color.white;
				component3.alignment = (TextAnchor)3;
				component3.supportRichText = false;
				((Graphic)component3).raycastTarget = false;
				SuggestionEntry item = new SuggestionEntry
				{
					Go = val,
					Button = val3,
					Background = component2,
					Label = component3,
					Id = null
				};
				_suggestions.Add(item);
			}
		}

		private void SelectByIndex(int index)
		{
			if (index >= 0 && index < _suggestions.Count && _suggestions[index].Go.activeSelf)
			{
				_selectedSuggestionIndex = index;
				ApplySuggestionHighlight();
				TrySelectCurrentSuggestion();
			}
		}

		private bool TrySelectCurrentSuggestion()
		{
			int visibleSuggestionCount = GetVisibleSuggestionCount();
			if (visibleSuggestionCount <= 0)
			{
				return false;
			}
			_selectedSuggestionIndex = Mathf.Clamp(_selectedSuggestionIndex, 0, visibleSuggestionCount - 1);
			SuggestionEntry suggestionEntry = _suggestions[_selectedSuggestionIndex];
			if (string.IsNullOrEmpty(suggestionEntry.Id))
			{
				return false;
			}
			_selecting = true;
			try
			{
				HideDropdown();
				_input.DeactivateInputField();
				_onSelected?.Invoke(suggestionEntry.Id);
			}
			finally
			{
				_selecting = false;
			}
			return true;
		}

		private static bool IsSubmitKeyDown()
		{
			return ZInput.GetKeyDown((KeyCode)13, true) || ZInput.GetKeyDown((KeyCode)271, true);
		}
	}
	internal static class TalentTreeLayoutCoordinator
	{
		public static float TreeBaseSize { get; private set; }

		public static float AutoFitZoom { get; private set; }

		private static TalentUiLayout Layout => TalentUiLayout.Default;

		private static Vector2 ComputeContentSize(float vpW, float vpH)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(vpW, vpH);
			float num2 = Layout.ScrollExtraPadding * (vpW / num);
			float num3 = Layout.ScrollExtraPadding * (vpH / num);
			float num4 = TreeBaseSize + 2f * num2;
			float num5 = TreeBaseSize + 2f * num3;
			float num6 = Mathf.Max(0.01f, Layout.StartZoom);
			float num7 = (vpW - vpH) / num6;
			float num8 = ((num7 > 0f) ? (num4 + num7) : num4);
			float num9 = ((num7 > 0f) ? num5 : (num5 - num7));
			return new Vector2(num8, num9);
		}

		public static RadialLayout.LayoutResult ApplyRadialLayout(TalentTreeView tree)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			string[] orderedIds = SectorRegistry.GetOrderedIds();
			RadialLayout.LayoutResult layoutResult = RadialLayout.ComputePositionsNoOverlap(TalentRegistry.All, orderedIds, RadialLayoutParams.FromLayout(Layout));
			foreach (KeyValuePair<string, Vector2> position in layoutResult.Positions)
			{
				tree.SetNodePosition(position.Key, position.Value);
			}
			return layoutResult;
		}

		public static void ResizeWorldToFit(float maxRadius, TalentWindowView view)
		{
			//IL_0051: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			TreeBaseSize = Mathf.Max(Layout.MinWorldSize, maxRadius * 2f + Layout.WorldPadding);
			float num = TreeBaseSize;
			float num2 = TreeBaseSize;
			Rect rect;
			if ((Object)(object)view?.ViewportRt != (Object)null)
			{
				rect = view.ViewportRt.rect;
				float width = ((Rect)(ref rect)).width;
				rect = view.ViewportRt.rect;
				float height = ((Rect)(ref rect)).height;
				if (width > 0f && height > 0f)
				{
					Vector2 val = ComputeContentSize(width, height);
					num = val.x;
					num2 = val.y;
				}
			}
			if ((Object)(object)view?.ContentRt != (Object)null)
			{
				view.ContentRt.sizeDelta = new Vector2(num, num2);
			}
			if ((Object)(object)view?.WorldRt != (Object)null)
			{
				view.WorldRt.sizeDelta = new Vector2(num, num2);
			}
			if ((Object)(object)view?.PathsRootRt != (Object)null)
			{
				SetupWorldLayer(view.PathsRootRt, num, num2);
			}
			if ((Object)(object)view?.NodesRootRt != (Object)null)
			{
				SetupWorldLayer(view.NodesRootRt, num, num2);
			}
			if ((Object)(object)view?.ScrollRect != (Object)null)
			{
				view.ScrollRect.normalizedPosition = new Vector2(0.5f, 0.5f);
			}
			AutoFitZoom = Layout.StartZoom;
			if ((Object)(object)view?.ViewportRt != (Object)null && TreeBaseSize > 0f)
			{
				rect = view.ViewportRt.rect;
				float width2 = ((Rect)(ref rect)).width;
				rect = view.ViewportRt.rect;
				float height2 = ((Rect)(ref rect)).height;
				if (width2 > 0f && height2 > 0f)
				{
					float num3 = Mathf.Min(width2 / TreeBaseSize, height2 / TreeBaseSize) * 0.9f;
					AutoFitZoom = Mathf.Clamp(num3, Layout.MinZoom, Layout.MaxZoom);
				}
			}
		}

		public static SectorLabelTracker InitSectorLabelTracker(TalentWindowView view, RadialLayout.LayoutResult layoutResult, Dictionary<string, RectTransform> nodeRects, SectorLabelTracker existing)
		{
			if ((Object)(object)existing != (Object)null)
			{
				existing.Cleanup();
				Object.Destroy((Object)(object)existing);
			}
			if ((Object)(object)view?.ViewportRt == (Object)null || (Object)(object)view?.WorldRt == (Object)null || (Object)(object)view?.ContentRt == (Object)null)
			{
				return null;
			}
			Transform parent = ((Transform)view.ViewportRt).parent;
			GameObject val = ((parent != null) ? ((Component)parent).gameObject : null) ?? ((Component)view.ViewportRt).gameObject;
			SectorLabelTracker sectorLabelTracker = val.AddComponent<SectorLabelTracker>();
			sectorLabelTracker.Initialize(view.WorldRt, view.ViewportRt, view.ContentRt, layoutResult.SectorMidAngles, layoutResult.Positions, nodeRects);
			return sectorLabelTracker;
		}

		public static void RecalculateForViewport(TalentWindowView view)
		{
			//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_0061: 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_0090: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)view?.ViewportRt == (Object)null || (Object)(object)view?.ContentRt == (Object)null || TreeBaseSize <= 0f)
			{
				return;
			}
			Rect rect = view.ViewportRt.rect;
			float width = ((Rect)(ref rect)).width;
			rect = view.ViewportRt.rect;
			float height = ((Rect)(ref rect)).height;
			if (!(width <= 0f) && !(height <= 0f))
			{
				Vector2 sizeDelta = ComputeContentSize(width, height);
				view.ContentRt.sizeDelta = sizeDelta;
				if ((Object)(object)view.WorldRt != (Object)null)
				{
					view.WorldRt.sizeDelta = sizeDelta;
				}
				float num = Mathf.Min(width / TreeBaseSize, height / TreeBaseSize) * 0.9f;
				AutoFitZoom = Mathf.Clamp(num, Layout.MinZoom, Layout.MaxZoom);
			}
		}

		private static void SetupWorldLayer(RectTransform rt, float width, float height)
		{
			//IL_000f: 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)
			if (!((Object)(object)rt == (Object)null))
			{
				UiFactory.SetCenter(rt, Vector2.zero, new Vector2(width, height));
			}
		}
	}
	public static class TalentWindow
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action <0>__Tick;

			public static UnityAction <1>__Toggle;

			public static UnityAction <2>__ToggleStats;

			public static UnityAction <3>__OnApplyClicked;

			public static UnityAction <4>__OnResetDraftClicked;

			public static Action <5>__HidePreview;

			public static Action<string, bool> <6>__ShowHoverPreview;

			public static Action<string> <7>__CenterOnNode;

			public static Action <8>__Refresh;

			public static Func<TalentDefinition, string> <9>__GetTalentDisplayName;

			public static Func<string, Vector2?> <10>__GetCenterTarget;
		}

		private static TalentWindowView _view;

		private static TalentTreeView _tree;

		private static TalentTreePathView _paths;

		private static TalentHoverTooltip _hoverTooltip;

		private static StatsPanelView _statsPanel;

		private static TalentApplyConfirmDialog _applyConfirmDialog;

		private static TalentSearchController _search;

		private static SectorLabelTracker _sectorTracker;

		private static Dictionary<string, RectTransform> _nodeRects;

		private static TalentWindowHoverController _hover;

		private static TalentWindowSelectionController _selection;

		private static TalentWindowGamepadController _gamepad;

		private const int WindowGroupPriority = 5;

		private static GameObject _gamepadGroup;

		private static GameObject _searchHint;

		private static bool _gamepadBound;

		private static bool _gamepadWasActive;

		private static GameObject _selectedBeforeOpen;

		private static int _reselectAtFrame;

		private static bool _statsOpen;

		private static GameObject _updaterHost;

		private static UpdateLoopRunner _loop;

		private static bool _pendingBuild;

		private static bool _pendingOpen;

		private static bool _loggedGuiNotReady;

		private static TalentUiLayout Layout => TalentUiLayout.Default;

		public static bool IsOpen => (Object)(object)_view?.Root != (Object)null && _view.Root.activeSelf;

		public static void EnsureBuilt()
		{
			if (GUIManager.Instance == null)
			{
				return;
			}
			EnsureUpdateLoop();
			if (_view != null && (Object)(object)_view.Root == (Object)null)
			{
				_view = null;
			}
			if ((Object)(object)GUIManager.CustomGUIFront == (Object)null)
			{
				_pendingBuild = true;
				return;
			}
			if (_view != null && (Object)(object)_view.Root != (Object)null && (Object)(object)_view.Root.transform.parent != (Object)(object)GUIManager.CustomGUIFront.transform)
			{
				Object.Destroy((Object)(object)_view.Root);
				_view = null;
			}
			if (_view != null)
			{
				return;
			}
			try
			{
				BuildUI();
			}
			catch (Exception arg)
			{
				Logger.LogError((object)$"Failed building Talent window UI: {arg}");
				_view = null;
			}
		}

		private static void EnsureUpdateLoop()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			if (!((Object)(object)_loop != (Object)null))
			{
				_updaterHost = new GameObject("TalentTree_UpdateLoop");
				Object.DontDestroyOnLoad((Object)(object)_updaterHost);
				_loop = _updaterHost.AddComponent<UpdateLoopRunner>();
				_loop.Tick = Tick;
			}
		}

		public static void Toggle()
		{
			EnsureBuilt();
			if ((Object)(object)_view?.Root == (Object)null)
			{
				_pendingBuild = true;
				_pendingOpen = true;
				if (!_loggedGuiNotReady)
				{
					Logger.LogWarning((object)"Talent window UI is not ready yet (Custom GUI is rebuilding). It will open automatically once available.");
					_loggedGuiNotReady = true;
				}
				return;
			}
			_loggedGuiNotReady = false;
			bool flag = !_view.Root.activeSelf;
			_view.Root.SetActive(flag);
			GUIManager.BlockInput(flag);
			if (flag)
			{
				OnOpened();
			}
			else
			{
				OnClosed();
			}
		}

		private static void EnsureGuiScaler()
		{
			GameObject customGUIFront = GUIManager.CustomGUIFront;
			if (!((Object)(object)customGUIFront == (Object)null) && !((Object)(object)customGUIFront.GetComponent<GuiScaler>() != (Object)null))
			{
				customGUIFront.AddComponent<GuiScaler>();
			}
		}

		private static void BuildUI()
		{
			//IL_0094: 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_009f: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_011c: 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: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			EnsureGuiScaler();
			_view = TalentWindowView.Build();
			_view.ApplyLocalization();
			_gamepadGroup = ((Component)UiFactory.CreateRect("GamepadGroup", _view.Root.transform)).gameObject;
			_gamepadGroup.AddComponent<UIGroupHandler>().m_groupPriority = 5;
			_gamepadGroup.SetActive(false);
			_gamepadBound = false;
			if ((Object)(object)_view.CloseButton != (Object)null)
			{
				ButtonClickedEvent onClick = _view.CloseButton.onClick;
				object obj = <>O.<1>__Toggle;
				if (obj == null)
				{
					UnityAction val = Toggle;
					<>O.<1>__Toggle = val;
					obj = (object)val;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj);
			}
			if ((Object)(object)_view.StatsButton != (Object)null)
			{
				ButtonClickedEvent onClick2 = _view.StatsButton.onClick;
				object obj2 = <>O.<2>__ToggleStats;
				if (obj2 == null)
				{
					UnityAction val2 = ToggleStats;
					<>O.<2>__ToggleStats = val2;
					obj2 = (object)val2;
				}
				((UnityEvent)onClick2).AddListener((UnityAction)obj2);
			}
			if ((Object)(object)_view.ApplyButton != (Object)null)
			{
				ButtonClickedEvent onClick3 = _view.ApplyButton.onClick;
				object obj3 = <>O.<3>__OnApplyClicked;
				if (obj3 == null)
				{
					UnityAction val3 = OnApplyClicked;
					<>O.<3>__OnApplyClicked = val3;
					obj3 = (object)val3;
				}
				((UnityEvent)onClick3).AddListener((UnityAction)obj3);
			}
			if ((Object)(object)_view.ResetButton != (Object)null)
			{
				ButtonClickedEvent onClick4 = _view.ResetButton.onClick;
				object obj4 = <>O.<4>__OnResetDraftClicked;
				if (obj4 == null)
				{
					UnityAction val4 = OnResetDraftClicked;
					<>O.<4>__OnResetDraftClicked = val4;
					obj4 = (object)val4;
				}
				((UnityEvent)onClick4).AddListener((UnityAction)obj4);
			}
			JotunnLocalization.LocalizationUpdated += delegate
			{
				_view?.ApplyLocalization();
				_statsPanel?.ApplyLocalization();
				_sectorTracker?.RefreshLabelText();
				_hoverTooltip?.ApplyLocalization();
				_applyConfirmDialog?.ApplyLocalization();
				if (_search != null)
				{
					_search.RebuildIndex(TalentRegistry.All);
				}
				if (IsOpen)
				{
					Refresh();
				}
			};
			_hover = new TalentWindowHoverController(Layout, () => _selection != null && _selection.Pinned, delegate(string id)
			{
				ShowHoverPreview(id);
			}, HidePreview);
			_selection = new TalentWindowSelectionController(_hover, ShowHoverPreview, HidePreview, CenterOnNode, Refresh);
			_tree = new TalentTreeView();
			_tree.Build(_view.NodesRootRt);
			_tree.NodeClicked += _selection.OnNodeClicked;
			_tree.NodeHoverEnter += _hover.OnNodeHoverEnter;
			_tree.NodeHoverExit += _hover.OnNodeHoverExit;
			RadialLayout.LayoutResult layoutResult = TalentTreeLayoutCoordinator.ApplyRadialLayout(_tree);
			_tree.CorrectIconRotations();
			_nodeRects = _tree.GetNodeRects();
			TalentTreeLayoutCoordinator.ResizeWorldToFit(layoutResult.MaxRadius, _view);
			_sectorTracker = TalentTreeLayoutCoordinator.InitSectorLabelTracker(_view, layoutResult, _nodeRects, _sectorTracker);
			_paths = new TalentTreePathView();
			_paths.Build(_view.PathsRootRt, _nodeRects);
			_paths.RebuildTransforms();
			_statsPanel = new StatsPanelView();
			_statsPanel.Build(_view.PanelRect, Layout);
			_statsPanel.ApplyLocalization();
			_statsPanel.SetVisible(visible: false);
			_hoverTooltip = new TalentHoverTooltip();
			_hoverTooltip.Build(_view.PanelRect);
			_hoverTooltip.SelectRequested += _selection.StageById;
			_hoverTooltip.SelectAllRequested += _selection.StageAllById;
			_hoverTooltip.DeselectRequested += _selection.UnstageById;
			_hoverTooltip.Hide();
			_applyConfirmDialog = new TalentApplyConfirmDialog();
			_applyConfirmDialog.Build(_view.PanelRect, delegate
			{
				_selection?.ApplyDraft();
			});
			if ((Object)(object)_view.PanelClickCatcher != (Object)null)
			{
				_view.PanelClickCatcher.Clicked += _selection.OnPanelClicked;
			}
			_search = new TalentSearchController(_view.SearchInput, _view.SearchInputRt, _view.SearchDropdown, _view.SearchDropdownRt, TalentUiTheme.Default, Layout);
			_search.Bind(GetTalentDisplayName, _selection.SelectTalent);
			_search.RebuildIndex(TalentRegistry.All);
			_gamepad = new TalentWindowGamepadController(_view, _nodeRects, _selection, GetCenterTarget, () => (_applyConfirmDialog != null && _applyConfirmDialog.IsVisible) || (_search != null && _search.IsDropdownVisible));
			ApplyZOrder();
		}

		private static void BindGamepad()
		{
			if (!_gamepadBound && !((Object)(object)InventoryGui.instance == (Object)null))
			{
				_gamepadBound = true;
				List<GameObject> list = new List<GameObject>();
				if ((Object)(object)_applyConfirmDialog?.Root != (Object)null)
				{
					list.Add(_applyConfirmDialog.Root);
				}
				if ((Object)(object)_view.SearchDropdown != (Object)null)
				{
					list.Add(_view.SearchDropdown);
				}
				GamepadHints.Bind(_view.CloseButton, null, "JoyButtonB", (KeyCode)0);
				BlockBy(GamepadHints.Bind(_view.StatsButton, "JoyRStick", null, (KeyCode)0), list);
				BlockBy(GamepadHints.Bind(_view.ApplyButton, "JoyButtonX", null, (KeyCode)0), list);
				BlockBy(GamepadHints.Bind(_view.ResetButton, "JoyBack", null, (KeyCode)0), list);
				BlockBy(_hoverTooltip?.BindGamepad(), list);
				_applyConfirmDialog?.BindGamepad();
				_searchHint = GamepadHints.CreateHint((Transform)(object)_view.SearchInputRt, "JoyLStick");
			}
		}

		private static void BlockBy(UIGamePad pad, List<GameObject> blockers)
		{
			if ((Object)(object)pad != (Object)null)
			{
				pad.m_blockingElements = blockers;
			}
		}

		private static void ApplyZOrder()
		{
			RectTransform searchInputRt = _view.SearchInputRt;
			if (searchInputRt != null)
			{
				((Transform)searchInputRt).SetAsLastSibling();
			}
			RectTransform searchDropdownRt = _view.SearchDropdownRt;
			if (searchDropdownRt != null)
			{
				((Transform)searchDropdownRt).SetAsLastSibling();
			}
			StatsPanelView statsPanel = _statsPanel;
			if (statsPanel != null)
			{
				GameObject root = statsPanel.Root;
				if (root != null)
				{
					root.transform.SetAsLastSibling();
				}
			}
			TalentHoverTooltip hoverTooltip = _hoverTooltip;
			if (hoverTooltip != null)
			{
				GameObject root2 = hoverTooltip.Root;
				if (root2 != null)
				{
					root2.transform.SetAsLastSibling();
				}
			}
			TalentApplyConfirmDialog applyConfirmDialog = _applyConfirmDialog;
			if (applyConfirmDialog != null)
			{
				GameObject root3 = applyConfirmDialog.Root;
				if (root3 != null)
				{
					root3.transform.SetAsLastSibling();
				}
			}
		}

		private static void OnOpened()
		{
			TalentPointsNotice.MarkSeen(Player.m_localPlayer);
			BindGamepad();
			EventSystem current = EventSystem.current;
			if ((Object)(object)current != (Object)null)
			{
				_selectedBeforeOpen = current.currentSelectedGameObject;
				current.SetSelectedGameObject((GameObject)null);
			}
			if (ZInput.instance != null)
			{
				ZInput.ResetButtonStatus("JoyButtonA");
			}
			_selection?.ResetOnOpen();
			_hover?.Reset();
			_gamepad?.Reset();
			_gamepadWasActive = ZInput.IsGamepadActive();
			_statsOpen = false;
			_hoverTooltip?.Hide();
			_statsPanel?.SetVisible(visible: false);
			_applyConfirmDialog?.Hide();
			_tree?.ClearAllHighlights();
			UpdateDraftButtonsInteractable();
			TalentTreeLayoutCoordinator.RecalculateForViewport(_view);
			float autoFitZoom = TalentTreeLayoutCoordinator.AutoFitZoom;
			float num = ((autoFitZoom > 0f) ? autoFitZoom : Layout.StartZoom);
			num = Mathf.Max(num, Layout.MinZoom);
			_view?.Zoom?.SetScale(num);
			if ((Object)(object)_view?.Zoom != (Object)null)
			{
				_view.Zoom.Initialize(_view.ViewportRt, _view.ContentRt, _view.ScrollRect, Layout.MinZoom, Layout.MaxZoom, Layout.ZoomFactorPerStep, Layout.MouseWheelDeadzone);
				_view.Zoom.SetScale(num);
			}
			_search?.Clear();
			_search?.RebuildIndex(TalentRegistry.All);
			Refresh();
		}

		private static void OnClosed()
		{
			_reselectAtFrame = Time.frameCount + 2;
		}

		private static void RestoreInventorySelection()
		{
			GameObject selectedBeforeOpen = _selectedBeforeOpen;
			_selectedBeforeOpen = null;
			EventSystem current = EventSystem.current;
			if ((Object)(object)current != (Object)null && (Object)(object)selectedBeforeOpen != (Object)null && selectedBeforeOpen.activeInHierarchy && InventoryGui.IsVisible())
			{
				current.SetSelectedGameObject(selectedBeforeOpen);
			}
		}

		private static void Tick()
		{
			if ((Object)(object)_selectedBeforeOpen != (Object)null && !IsOpen && Time.frameCount >= _reselectAtFrame)
			{
				RestoreInventorySelection();
			}
			if (_pendingBuild || _pendingOpen)
			{
				if (_view != null && (Object)(object)_view.Root == (Object)null)
				{
					_view = null;
				}
				if (GUIManager.Instance != null && (Object)(object)GUIManager.CustomGUIFront != (Object)null)
				{
					EnsureBuilt();
					_pendingBuild = false;
					_loggedGuiNotReady = false;
					if (_pendingOpen && (Object)(object)_view?.Root != (Object)null)
					{
						_pendingOpen = false;
						if (!_view.Root.activeSelf)
						{
							_view.Root.SetActive(true);
							GUIManager.BlockInput(true);
							OnOpened();
						}
					}
				}
			}
			if (!IsOpen)
			{
				return;
			}
			bool buttonDown = ZInput.GetButtonDown("JoyButtonB");
			if (buttonDown || ZInput.GetKeyDown((KeyCode)27, true) || Input.GetKeyDown((KeyCode)27))
			{
				if (buttonDown)
				{
					ZInput.ResetButtonStatus("JoyButtonB");
				}
				if (_applyConfirmDialog != null && _applyConfirmDialog.IsVisible)
				{
					_applyConfirmDialog.Hide();
				}
				else if (_search != null && _search.IsDropdownVisible)
				{
					_search.HideDropdown();
				}
				else
				{
					if (buttonDown || _selection == null || !_selection.Pinned)
					{
						Toggle();
						return;
					}
					_selection.CloseAndUnpin();
				}
			}
			_search?.Tick();
			_hoverTooltip?.Tick();
			bool flag = _applyConfirmDialog != null && _applyConfirmDialog.IsVisible;
			bool flag2 = ZInput.IsExclusiveGamepadActive() && !ZInput.IsTouchActive();
			if (flag2 && !flag)
			{
				_search?.TickGamepad();
			}
			if ((Object)(object)_searchHint != (Object)null && _searchHint.activeSelf != flag2)
			{
				_searchHint.SetActive(flag2);
			}
			_gamepad?.Tick();
			bool flag3 = ZInput.IsGamepadActive();
			if ((Object)(object)_gamepadGroup != (Object)null && _gamepadGroup.activeSelf != flag3)
			{
				_gamepadGroup.SetActive(flag3);
			}
			if (flag3)
			{
				ClearSelection();
			}
			if (flag3 != _gamepadWasActive)
			{
				_gamepadWasActive = flag3;
				Refresh();
			}
			if (_hoverTooltip != null && _nodeRects != null && _selection != null && _hover != null)
			{
				string text = (_selection.Pinned ? _selection.SelectedId : _hover.CandidateId);
				if (!string.IsNullOrEmpty(text) && _nodeRects.TryGetValue(text, out var value))
				{
					_hoverTooltip.UpdatePosition(value);
				}
			}
			_hover?.Tick();
		}

		private static void ClearSelection()
		{
			EventSystem current = EventSystem.current;
			GameObject val = (((Object)(object)current != (Object)null) ? current.currentSelectedGameObject : null);
			if ((Object)(object)val != (Object)null && val.transform.IsChildOf(_view.Root.transform))
			{
				current.SetSelectedGameObject((GameObject)null);
			}
		}

		private static void HidePreview()
		{
			_hoverTooltip?.Hide();
			_tree?.ClearAllHighlights();
		}

		private static void ShowHoverPreview(string id, bool pinned = false)
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && TalentRegistry.TryGet(id, out var def))
			{
				_tree.ClearAllHighlights();
				_tree.SetHighlighted(id, on: true, Layout.SelectedNodeScale);
				TalentRuntime rt = TalentRuntimeService.Get(Player.m_localPlayer);
				int value = 0;
				int value2 = 0;
				rt?.State.Ranks.TryGetValue(id, out value);
				rt?.DraftRanks.TryGetValue(id, out value2);
				bool canUnlock = rt != null && TalentWindowSelectionController.CanUnlock(rt, def);
				Func<string, int> getRank = ((rt != null) ? new Func<string, int>(rt.GetEffectiveRank) : null);
				int value4;
				Func<string, int> committedRank = ((rt != null) ? ((Func<string, int>)((string tid) => rt.State.Ranks.TryGetValue(tid, out value4) ? value4 : 0)) : null);
				if (_nodeRects != null && _nodeRects.TryGetValue(id, out var value3))
				{
					_hoverTooltip?.ShowFor(def, value3, value, value2, getRank, committedRank, canUnlock, pinned);
				}
			}
		}

		private static void CenterOnNode(string id)
		{
			//IL_0024: 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)
			Vector2? centerTarget = GetCenterTarget(id);
			if (centerTarget.HasValue)
			{
				_view.ContentRt.anchoredPosition = centerTarget.Value;
				if ((Object)(object)_view.ScrollRect != (Object)null)
				{
					_view.ScrollRect.velocity = Vector2.zero;
				}
			}
		}

		private static Vector2? GetCenterTarget(string id)
		{
			//IL_00c4: 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_00d5: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_view?.ContentRt == (Object)null || (Object)(object)_view.ViewportRt == (Object)null)
			{
				return null;
			}
			if (_nodeRects == null && _tree != null)
			{
				_nodeRects = _tree.GetNodeRects();
			}
			if (_nodeRects == null)
			{
				return null;
			}
			if (!_nodeRects.TryGetValue(id, out var value) || (Object)(object)value == (Object)null)
			{
				return null;
			}
			float x = ((Transform)_view.ContentRt).localScale.x;
			Vector2 anchoredPosition = value.anchoredPosition;
			Vector2 val = -anchoredPosition * x;
			float num = _view.ContentRt.sizeDelta.x * x;
			float num2 = _view.ContentRt.sizeDelta.y * x;
			Rect rect = _view.ViewportRt.rect;
			float width = ((Rect)(ref rect)).width;
			rect = _view.ViewportRt.rect;
			float height = ((Rect)(ref rect)).height;
			float num3 = Mathf.Max(0f, (num - width) * 0.5f);
			float num4 = Mathf.Max(0f, (num2 - height) * 0.5f);
			val.x = Mathf.Clamp(val.x, 0f - num3, num3);
			val.y = Mathf.Clamp(val.y, 0f - num4, num4);
			return val;
		}

		private static void OnApplyClicked()
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null))
			{
				int pendingCost = TalentDraftService.GetPendingCost(Player.m_localPlayer);
				if (pendingCost > 0)
				{
					int availableBeforeApply = TalentPointBudgetService.GetAvailablePoints(Player.m_localPlayer) + pendingCost;
					_applyConfirmDialog?.Show(pendingCost, availableBeforeApply);
				}
			}
		}

		private static void OnResetDraftClicked()
		{
			_selection?.ResetDraft();
		}

		private static void UpdateDraftButtonsInteractable()
		{
			bool active = TalentWindowSelectionController.HasPendingDraft();
			TalentWindowView view = _view;
			if (view != null)
			{
				Button applyButton = view.ApplyButton;
				if (applyButton != null)
				{
					((Component)applyButton).gameObject.SetActive(active);
				}
			}
			TalentWindowView view2 = _view;
			if (view2 != null)
			{
				Button resetButton = view2.ResetButton;
				if (resetButton != null)
				{
					((Component)resetButton).gameObject.SetActive(active);
				}
			}
		}

		private static void ToggleStats()
		{
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			_statsOpen = !_statsOpen;
			_statsPanel?.SetVisible(_statsOpen);
			if (_statsOpen)
			{
				TalentRuntime talentRuntime = TalentRuntimeService.Get(Player.m_localPlayer);
				if (talentRuntime != null)
				{
					_statsPanel?.Refresh(talentRuntime);
				}
			}
		}

		private static void Refresh()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			TalentRuntime talentRuntime = TalentRuntimeService.Get(Player.m_localPlayer);
			if (talentRuntime != null)
			{
				if ((Object)(object)_view?.PointsText != (Object)null)
				{
					int availablePoints = TalentPointBudgetService.GetAvailablePoints(Player.m_localPlayer, talentRuntime);
					_view.PointsText.text = availablePoints.ToString();
					Color plannedTextColor = TalentUiTheme.Default.PlannedTextColor;
					BlinkingTextEffect.SetActive(_view.PointsText, TalentDraftService.HasPendingDraft(Player.m_localPlayer), BlinkingTextEffect.Darken(plannedTextColor, 0.55f), plannedTextColor, Color.white);
				}
				_tree.UpdateVisuals(talentRuntime, Player.m_localPlayer);
				_paths.UpdateVisuals(talentRuntime, Player.m_localPlayer);
				if (_statsOpen)
				{
					_statsPanel?.Refresh(talentRuntime);
				}
				if (_selection != null && _selection.Pinned && !string.IsNullOrEmpty(_selection.SelectedId))
				{
					ShowHoverPreview(_selection.SelectedId, pinned: true);
				}
				UpdateDraftButtonsInteractable();
			}
		}

		private static string GetTalentDisplayName(TalentDefinition def)
		{
			if (def == null)
			{
				return string.Empty;
			}
			return JotunnLocalization.TranslateSmart(def.NameKey) ?? def.Id ?? string.Empty;
		}
	}
	internal sealed class TalentWindowGamepadController
	{
		private const float MinNeighbourDot = 0.26f;

		private const float SameDirectionDot = 0.05f;

		private const float MinDirectionDot = 0.5f;

		private const float AnglePenalty = 2f;

		private const float MinStepInterval = 0.08f;

		private const float StickDeadzone = 0.2f;

		private readonly TalentWindowView _view;

		private readonly Dictionary<string, RectTransform> _nodes;

		private readonly TalentWindowSelectionController _selection;

		private readonly Func<string, Vector2?> _centerTarget;

		private readonly Func<bool> _blocked;

		private string _glideTo;

		private float _lastStepAt;

		private static TalentUiLayout Layout => TalentUiLayout.Default;

		public TalentWindowGamepadController(TalentWindowView view, Dictionary<string, RectTransform> nodes, TalentWindowSelectionController selection, Func<string, Vector2?> centerTarget, Func<bool> blocked)
		{
			_view = view;
			_nodes = nodes;
			_selection = selection;
			_centerTarget = centerTarget;
			_blocked = blocked;
		}

		public void Reset()
		{
			_glideTo = null;
			_lastStepAt = 0f;
		}

		public void Tick()
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			if (!ZInput.IsExclusiveGamepadActive() || ZInput.IsTouchActive() || _blocked())
			{
				_glideTo = null;
			}
			else
			{
				if ((Object)(object)_view?.ContentRt == (Object)null || _nodes == null)
				{
					return;
				}
				string text = (_selection.Pinned ? _selection.SelectedId : null);
				if (text == null || !_nodes.ContainsKey(text))
				{
					text = NearestTo(ViewCenter(), null);
					if (text == null)
					{
						return;
					}
					_selection.Focus(text);
				}
				Vector2 val = ReadDirection();
				if (val != Vector2.zero)
				{
					FocusAndGlide(NextInDirection(text, val));
				}
				else if (ZInput.GetButtonDown("JoyTabLeft"))
				{
					FocusAndGlide(NextInSector(text, counterClockwise: true));
				}
				else if (ZInput.GetButtonDown("JoyTabRight"))
				{
					FocusAndGlide(NextInSector(text, counterClockwise: false));
				}
				if (ZInput.GetButtonDown("JoyButtonY"))
				{
					_selection.UnstageById(_selection.SelectedId);
				}
				Pan();
				Zoom();
				Glide();
			}
		}

		private void FocusAndGlide(string id)
		{
			if (id != null)
			{
				if ((Object)(object)GamepadRumble.instance != (Object)null)
				{
					GamepadRumble.instance.PlayGlobalSelectVibration();
				}
				_selection.Focus(id);
				_glideTo = id;
			}
		}

		private Vector2 ReadDirection()
		{
			//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_003c: 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_00dd: 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_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_00ee: 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)
			//IL_0122: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Vector2.zero;
			if (ZInput.GetButtonDown("JoyLStickLeft") || ZInput.GetButtonDown("JoyLStickRight") || ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyLStickDown"))
			{
				val = ZInput.GetJoyLeftStick();
			}
			if (((Vector2)(ref val)).magnitude < 0.2f)
			{
				val = Vector2.zero;
				if (ZInput.GetButtonDown("JoyDPadLeft"))
				{
					val.x -= 1f;
				}
				if (ZInput.GetButtonDown("JoyDPadRight"))
				{
					val.x += 1f;
				}
				if (ZInput.GetButtonDown("JoyDPadUp"))
				{
					val.y += 1f;
				}
				if (ZInput.GetButtonDown("JoyDPadDown"))
				{
					val.y -= 1f;
				}
			}
			if (val == Vector2.zero)
			{
				return val;
			}
			if (Time.unscaledTime - _lastStepAt < 0.08f)
			{
				return Vector2.zero;
			}
			_lastStepAt = Time.unscaledTime;
			return ((Vector2)(ref val)).normalized;
		}

		private string NextInDirection(string from, Vector2 direction)
		{
			//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_0067: 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_006d: 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_008e: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			Vector2 anchoredPosition = _nodes[from].anchoredPosition;
			string text = null;
			float num = 0f;
			float num2 = 0f;
			foreach (string neighbor in TalentConnectionService.GetNeighbors(from))
			{
				if (!_nodes.TryGetValue(neighbor, out var value) || (Object)(object)value == (Object)null)
				{
					continue;
				}
				Vector2 val = value.anchoredPosition - anchoredPosition;
				float magnitude = ((Vector2)(ref val)).magnitude;
				if (magnitude < 0.001f)
				{
					continue;
				}
				float num3 = Vector2.Dot(val / magnitude, direction);
				if (num3 < 0.26f)
				{
					continue;
				}
				if (text != null)
				{
					bool flag = num3 > num + 0.05f;
					bool flag2 = num3 > num - 0.05f && magnitude < num2;
					if (!flag && !flag2)
					{
						continue;
					}
				}
				text = neighbor;
				num = num3;
				num2 = magnitude;
			}
			if (text != null)
			{
				return text;
			}
			string result = null;
			float num4 = float.MaxValue;
			foreach (KeyValuePair<string, RectTransform> node in _nodes)
			{
				if (node.Key == from || (Object)(object)node.Value == (Object)null)
				{
					continue;
				}
				Vector2 val2 = node.Value.anchoredPosition - anchoredPosition;
				float magnitude2 = ((Vector2)(ref val2)).magnitude;
				if (magnitude2 < 0.001f)
				{
					continue;
				}
				float num5 = Vector2.Dot(val2 / magnitude2, direction);
				if (!(num5 < 0.5f))
				{
					float num6 = magnitude2 * (1f + 2f * (1f - num5));
					if (!(num6 >= num4))
					{
						num4 = num6;
						result = node.Key;
					}
				}
			}
			return result;
		}

		private string NextInSector(string from, bool counterClockwise)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (!TalentRegistry.TryGet(from, out var def))
			{
				return null;
			}
			List<KeyValuePair<string, float>> list = SectorAngles();
			int num = list.FindIndex((KeyValuePair<string, float> s) => s.Key == def.SectorId);
			if (num < 0 || list.Count < 2)
			{
				return null;
			}
			KeyValuePair<string, float> keyValuePair = list[(num + (counterClockwise ? 1 : (list.Count - 1))) % list.Count];
			float num2 = Mathf.DeltaAngle(list[num].Value, keyValuePair.Value);
			Vector2 position = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, num2) * Vector2.op_Implicit(_nodes[from].anchoredPosition));
			return NearestTo(position, keyValuePair.Key);
		}

		private List<KeyValuePair<string, float>> SectorAngles()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			Dictionary<string, Vector2> dictionary = new Dictionary<string, Vector2>();
			foreach (KeyValuePair<string, RectTransform> node in _nodes)
			{
				if (!((Object)(object)node.Value == (Object)null) && TalentRegistry.TryGet(node.Key, out var def))
				{
					dictionary.TryGetValue(def.SectorId, out var value);
					dictionary[def.SectorId] = value + node.Value.anchoredPosition;
				}
			}
			List<KeyValuePair<string, float>> list = new List<KeyValuePair<string, float>>(dictionary.Count);
			foreach (KeyValuePair<string, Vector2> item in dictionary)
			{
				list.Add(new KeyValuePair<string, float>(item.Key, Mathf.Atan2(item.Value.y, item.Value.x) * 57.29578f));
			}
			list.Sort((KeyValuePair<string, float> a, KeyValuePair<string, float> b) => a.Value.CompareTo(b.Value));
			return list;
		}

		private string NearestTo(Vector2 position, string sectorId)
		{
			//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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			string result = null;
			float num = float.MaxValue;
			foreach (KeyValuePair<string, RectTransform> node in _nodes)
			{
				if (!((Object)(object)node.Value == (Object)null) && (sectorId == null || (TalentRegistry.TryGet(node.Key, out var def) && !(def.SectorId != sectorId))))
				{
					Vector2 val = node.Value.anchoredPosition - position;
					float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude;
					if (!(sqrMagnitude >= num))
					{
						num = sqrMagnitude;
						result = node.Key;
					}
				}
			}
			return result;
		}

		private Vector2 ViewCenter()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_001f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			float x = ((Transform)_view.ContentRt).localScale.x;
			return (x > 0f) ? (-_view.ContentRt.anchoredPosition / x) : Vector2.zero;
		}

		private void Pan()
		{
			//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_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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			Vector2 joyRightStick = ZInput.GetJoyRightStick();
			if (!(((Vector2)(ref joyRightStick)).magnitude < 0.2f))
			{
				_glideTo = null;
				RectTransform contentRt = _view.ContentRt;
				contentRt.anchoredPosition -= joyRightStick * (Layout.GamepadPanSpeed * Time.unscaledDeltaTime);
				StopInertia();
			}
		}

		private void Zoom()
		{
			if (!((Object)(object)_view.Zoom == (Object)null))
			{
				float num = (ZInput.GetButton("JoyMapZoomIn") ? 1f : 0f) - (ZInput.GetButton("JoyMapZoomOut") ? 1f : 0f);
				if (num != 0f)
				{
					_view.Zoom.ZoomAtCenter(Mathf.Pow(1f + _view.Zoom.ZoomFactorPerStep, num * Layout.GamepadZoomStepsPerSecond * Time.unscaledDeltaTime));
				}
			}
		}

		private void Glide()
		{
			//IL_004b: 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_0073: 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_007b: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (_glideTo == null)
			{
				return;
			}
			Vector2? val = _centerTarget(_glideTo);
			if (!val.HasValue)
			{
				_glideTo = null;
				return;
			}
			Vector2 val2 = Vector2.Lerp(_view.ContentRt.anchoredPosition, val.Value, 1f - Mathf.Exp((0f - Layout.GamepadGlideSpeed) * Time.unscaledDeltaTime));
			Vector2 val3 = val.Value - val2;
			if (((Vector2)(ref val3)).sqrMagnitude < 0.25f)
			{
				val2 = val.Value;
				_glideTo = null;
			}
			_view.ContentRt.anchoredPosition = val2;
			StopInertia();
		}

		private void StopInertia()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_view.ScrollRect != (Object)null)
			{
				_view.ScrollRect.velocity = Vector2.zero;
			}
		}
	}
	internal sealed class TalentWindowHoverController
	{
		private readonly TalentUiLayout _layout;

		private readonly Func<bool> _isPinned;

		private readonly Action<string> _showPreview;

		private readonly Action _hidePreview;

		private float _enterAt;

		private bool _previewShown;

		public string CandidateId { get; private set; }

		public TalentWindowHoverController(TalentUiLayout layout, Func<bool> isPinned, Action<string> showPreview, Action hidePreview)
		{
			_layout = layout;
			_isPinned = isPinned;
			_showPreview = showPreview;
			_hidePreview = hidePreview;
		}

		public void OnNodeHoverEnter(string id)
		{
			if (!_isPinned())
			{
				_hidePreview();
				CandidateId = id;
				_enterAt = Time.unscaledTime;
				_previewShown = false;
			}
		}

		public void OnNodeHoverExit(string id)
		{
			if (!_isPinned() && !(CandidateId != id))
			{
				Reset();
				_hidePreview();
			}
		}

		public void Tick()
		{
			if (!_isPinned() && !string.IsNullOrEmpty(CandidateId) && !_previewShown && !QuickSkillInput.IsAnyHeld() && Time.unscaledTime - _enterAt >= _layout.HoverDelaySeconds)
			{
				_showPreview(CandidateId);
				_previewShown = true;
			}
		}

		public void Reset()
		{
			CandidateId = null;
			_previewShown = false;
		}

		public void AdoptClick(string id)
		{
			CandidateId = id;
			_previewShown = true;
		}
	}
	internal sealed class TalentWindowSelectionController
	{
		private readonly TalentWindowHoverController _hover;

		private readonly Action<string, bool> _showPreview;

		private readonly Action _hidePreview;

		private readonly Action<string> _centerOnNode;

		private readonly Action _refresh;

		private int _nodeClickedFrame = -1;

		public bool Pinned { get; private set; }

		public string SelectedId { get; private set; }

		public TalentWindowSelectionController(TalentWindowHoverController hover, Action<string, bool> showPreview, Action hidePreview, Action<string> centerOnNode, Action refresh)
		{
			_hover = hover;
			_showPreview = showPreview;
			_hidePreview = hidePreview;
			_centerOnNode = centerOnNode;
			_refresh = refresh;
		}

		public void ResetOnOpen()
		{
			Pinned = false;
			SelectedId = null;
		}

		public void OnNodeClicked(string id)
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && TalentRegistry.TryGet(id, out var _))
			{
				if (QuickSkillInput.IsDeselectHeld())
				{
					UnstageAllById(id);
					return;
				}
				if (QuickSkillInput.IsSelectAllHeld())
				{
					StageAllById(id);
					return;
				}
				Pinned = true;
				SelectedId = id;
				_hover.AdoptClick(id);
				_nodeClickedFrame = Time.frameCount;
				_showPreview(id, arg2: true);
				_refresh();
			}
		}

		public void Focus(string id)
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && TalentRegistry.TryGet(id, out var _))
			{
				Pinned = true;
				SelectedId = id;
				_hover.AdoptClick(id);
				_showPreview(id, arg2: true);
			}
		}

		public void SelectTalent(string id)
		{
			if (!string.IsNullOrEmpty(id))
			{
				_hidePreview();
				_centerOnNode(id);
				OnNodeClicked(id);
			}
		}

		public void StageById(string id)
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && !string.IsNullOrEmpty(id) && TalentDraftService.TryStage(Player.m_localPlayer, id, out var _))
			{
				_refresh();
			}
		}

		public void StageAllById(string id)
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && !string.IsNullOrEmpty(id))
			{
				TalentDraftService.StageAll(Player.m_localPlayer, id);
				_refresh();
			}
		}

		public void UnstageById(string id)
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && !string.IsNullOrEmpty(id) && TalentDraftService.TryUnstage(Player.m_localPlayer, id))
			{
				_refresh();
			}
		}

		public void UnstageAllById(string id)
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && !string.IsNullOrEmpty(id) && TalentDraftService.TryUnstageAll(Player.m_localPlayer, id))
			{
				_refresh();
			}
		}

		public void ApplyDraft()
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null))
			{
				TalentDraftService.ApplyDraft(Player.m_localPlayer);
				_refresh();
			}
		}

		public void ResetDraft()
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null))
			{
				TalentDraftService.ResetDraft(Player.m_localPlayer);
				_refresh();
			}
		}

		public static bool HasPendingDraft()
		{
			return (Object)(object)Player.m_localPlayer != (Object)null && TalentDraftService.HasPendingDraft(Player.m_localPlayer);
		}

		public static bool CanUnlock(TalentRuntime rt, TalentDefinition def)
		{
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return false;
			}
			string reason;
			return TalentUnlockService.CanUnlock(Player.m_localPlayer, rt, def, out reason);
		}

		public void OnPanelClicked()
		{
			if (Pinned && _nodeClickedFrame != Time.frameCount)
			{
				CloseAndUnpin();
			}
		}

		public void CloseAndUnpin()
		{
			Pinned = false;
			SelectedId = null;
			_hover.Reset();
			_hidePreview();
			_refresh();
		}
	}
	internal static class QuickSkillInput
	{
		public static bool IsSelectAllHeld()
		{
			return ZInput.GetKey((KeyCode)304, true) || ZInput.GetKey((KeyCode)303, true);
		}

		public static bool IsDeselectHeld()
		{
			return ZInput.GetKey((KeyCode)306, true) || ZInput.GetKey((KeyCode)305, true);
		}

		public static bool IsAnyHeld()
		{
			return IsSelectAllHeld() || IsDeselectHeld();
		}
	}
	internal static class UiFactory
	{
		internal readonly struct RectPreset
		{
			public readonly Vector2 AnchorMin;

			public readonly Vector2 AnchorMax;

			public readonly Vector2 Pivot;

			public RectPreset(Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				AnchorMin = anchorMin;
				AnchorMax = anchorMax;
				Pivot = pivot;
			}
		}

		internal static class Presets
		{
			public static readonly RectPreset TopLeft = new RectPreset(new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f));

			public static readonly RectPreset TopCenter = new RectPreset(new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f));

			public static readonly RectPreset TopRight = new RectPreset(new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f));

			public static readonly RectPreset Center = new RectPreset(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f));

			public static readonly RectPreset BottomLeft = new RectPreset(new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(0f, 0f));

			public static readonly RectPreset BottomCenter = new RectPreset(new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f));

			public static readonly RectPreset BottomRight = new RectPreset(new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(1f, 0f));

			public static readonly RectPreset StretchFull = new RectPreset(new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f));

			public static readonly RectPreset StretchXTop = new RectPreset(new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f));

			public static readonly RectPreset StretchYRight = new RectPreset(new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f));
		}

		private static Sprite _whiteSprite;

		private static Sprite _circleSprite;

		private static Sprite _circleMaskSprite;

		private static Sprite _diamondSprite;

		public static Sprite GetWhiteSprite()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_whiteSprite != (Object)null)
			{
				return _whiteSprite;
			}
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
			val.SetPixel(0, 0, Color.white);
			val.Apply(false, true);
			_whiteSprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f);
			((Object)_whiteSprite).name = "RuntimeWhiteSprite";
			return _whiteSprite;
		}

		public static Sprite GetCircleSprite()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00ef: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_circleSprite != (Object)null)
			{
				return _circleSprite;
			}
			Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			float num = 127.5f;
			float num2 = num - 1f;
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num3 = (float)j - num;
					float num4 = (float)i - num;
					float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
					float num6 = Mathf.Clamp01(num2 + 1.5f - num5);
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num6));
				}
			}
			val.Apply(false, true);
			_circleSprite = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
			((Object)_circleSprite).name = "RuntimeCircleSprite";
			return _circleSprite;
		}

		public static Sprite GetDiamondSprite()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_diamondSprite != (Object)null)
			{
				return _diamondSprite;
			}
			Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			float num = 127.5f;
			float num2 = num * 0.92f;
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num3 = Mathf.Abs((float)j - num) + Mathf.Abs((float)i - num);
					float num4 = Mathf.Clamp01((num2 - num3) / 1.4142135f + 0.5f);
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num4));
				}
			}
			val.Apply(false, true);
			_diamondSprite = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
			((Object)_diamondSprite).name = "RuntimeDiamondSprite";
			return _diamondSprite;
		}

		public static Sprite GetCircleMaskSprite()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00f1: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_circleMaskSprite != (Object)null)
			{
				return _circleMaskSprite;
			}
			Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			float num = 127.5f;
			float num2 = num - 1f;
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num3 = (float)j - num;
					float num4 = (float)i - num;
					float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
					float num6 = ((num5 <= num2) ? 1f : 0f);
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num6));
				}
			}
			val.Apply(false, true);
			_circleMaskSprite = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
			((Object)_circleMaskSprite).name = "RuntimeCircleMaskSprite";
			return _circleMaskSprite;
		}

		private static void ApplyPivot(GameObject go, Vector2 pivot)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (((Object)(object)go != (Object)null) ? go.GetComponent<RectTransform>() : null);
			if ((Object)(object)val != (Object)null)
			{
				val.pivot = pivot;
			}
		}

		public static GameObject CreateRoot(string name, Transform parent, bool startActive = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.SetActive(startActive);
			return val;
		}

		public static RectTransform CreateRect(string name, Transform parent)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			return (RectTransform)val.transform;
		}

		public static RectTransform SetRect(RectTransform rt, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0002: 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_0012: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = anchorMin;
			rt.anchorMax = anchorMax;
			rt.pivot = pivot;
			rt.anchoredPosition = anchoredPosition;
			rt.sizeDelta = sizeDelta;
			return rt;
		}

		public static RectTransform SetRect(RectTransform rt, RectPreset preset, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, preset.AnchorMin, preset.AnchorMax, preset.Pivot, anchoredPosition, sizeDelta);
		}

		public static RectTransform SetTopLeft(RectTransform rt, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, Presets.TopLeft, anchoredPosition, sizeDelta);
		}

		public static RectTransform SetTopCenter(RectTransform rt, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, Presets.TopCenter, anchoredPosition, sizeDelta);
		}

		public static RectTransform SetTopRight(RectTransform rt, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, Presets.TopRight, anchoredPosition, sizeDelta);
		}

		public static RectTransform SetCenter(RectTransform rt, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, Presets.Center, anchoredPosition, sizeDelta);
		}

		public static RectTransform SetBottomLeft(RectTransform rt, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, Presets.BottomLeft, anchoredPosition, sizeDelta);
		}

		public static RectTransform SetBottomCenter(RectTransform rt, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, Presets.BottomCenter, anchoredPosition, sizeDelta);
		}

		public static RectTransform SetBottomRight(RectTransform rt, Vector2 anchoredPosition, Vector2 sizeDelta)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SetRect(rt, Presets.BottomRight, anchoredPosition, sizeDelta);
		}

		public static GameObject CreateWoodPanel(Transform parent, string name, RectPreset preset, Vector2 position, Vector2 size, bool draggable)
		{
			//IL_0004: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateWoodPanel(parent, name, preset.AnchorMin, preset.AnchorMax, position, size, draggable);
			ApplyPivot(val, preset.Pivot);
			return val;
		}

		public static GameObject CreateWoodPanelCenter(Transform parent, string name, Vector2 position, Vector2 size, bool draggable)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return CreateWoodPanel(parent, name, Presets.Center, position, size, draggable);
		}

		public static GameObject CreateWoodPanel(Transform parent, string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, Vector2 size, bool draggable)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			GameObject val = GUIManager.Instance.CreateWoodpanel(parent, anchorMin, anchorMax, position, size.x, size.y, draggable);
			((Object)val).name = name;
			return val;
		}

		public static (GameObject go, Text text) CreateText(Transform parent, string name, string text, RectPreset preset, Vector2 position, Vector2 size, Font font, int fontSize, Color color, bool outline, Color outlineColor)
		{
			//IL_0005: 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_0012: 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_001c: 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)
			var (val, item) = CreateText(parent, name, text, preset.AnchorMin, preset.AnchorMax, position, size, font, fontSize, color, outline, outlineColor);
			ApplyPivot(val, preset.Pivot);
			return (go: val, text: item);
		}

		public static (GameObject go, Text text) CreateTextTopLeft(Transform parent, string name, string text, Vector2 position, Vector2 size, Font font, int fontSize, Color color, bool outline, Color outlineColor)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return CreateText(parent, name, text, Presets.TopLeft, position, size, font, fontSize, color, outline, outlineColor);
		}

		public static (GameObject go, Text text) CreateTextTopCenter(Transform parent, string name, string text, Vector2 position, Vector2 size, Font font, int fontSize, Color color, bool outline, Color outlineColor)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return CreateText(parent, name, text, Presets.TopCenter, position, size, font, fontSize, color, outline, outlineColor);
		}

		public static (GameObject go, Text text) CreateTextTopRight(Transform parent, string name, string text, Vector2 position, Vector2 size, Font font, int fontSize, Color color, bool outline, Color outlineColor)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)