Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TalentTree v1.0.2
TalentTree.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
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.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 BepInEx; 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 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.IgnoreSymbolStoreSequencePoints)] [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("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e135eec60e693fbedc7cd0e8693e26cf4a05fdc8")] [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 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00e8: 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) Result result = new Result(); Text item = UiFactory.CreateTextTopCenter(panel, "Title", JotunnLocalization.T("tt_ui_talents_title"), layout.TitleOffset, layout.TitleSize, GUIManager.Instance.AveriaSerifBold, layout.TitleFontSize, Color.white, outline: true, Color.black).text; item.alignment = (TextAnchor)4; result.TitleText = item; Button item2 = UiFactory.CreateButtonTopRight(panel, "CloseButton", "X", layout.CloseButtonOffset, layout.CloseButtonSize).button; result.CloseButton = item2; Text item3 = UiFactory.CreateTextTopLeft(panel, "Points", JotunnLocalization.Format("tt_ui_points_format", 0), layout.PointsOffset, layout.PointsSize, GUIManager.Instance.AveriaSerifBold, layout.PointsFontSize, Color.white, outline: true, Color.black).text; result.PointsText = item3; (GameObject go, Button button, Text label) tuple = UiFactory.CreateButtonTopLeft(panel, "StatsButton", JotunnLocalization.T("tt_ui_stats"), layout.StatsButtonOffset, layout.StatsButtonSize); Button item4 = tuple.button; Text item5 = tuple.label; result.StatsButton = item4; result.StatsBtnLabel = item5; 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //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) //IL_0098: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032a: 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 obj = UiFactory.CreateRect("Placeholder", val.transform); UiFactory.SetRectStretch(obj, val2.offsetMin, val2.offsetMax); Text val4 = ((Component)obj).gameObject.AddComponent<Text>(); val4.text = JotunnLocalization.T("tt_ui_search_placeholder"); val4.font = GUIManager.Instance.AveriaSerifBold; val4.fontSize = layout.SearchFontSize; ((Graphic)val4).color = theme.SearchPlaceholderColor; val4.alignment = (TextAnchor)3; ((Graphic)val4).raycastTarget = false; result.SearchInput.placeholder = (Graphic)(object)val4; 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_0014: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) Result result = new Result(); RectTransform val = UiFactory.CreateRect("TalentTree_Area", panel); UiFactory.SetRectStretch(val, layout.TreeAreaPaddingMin, layout.TreeAreaPaddingMax); Image obj = ((Component)val).gameObject.AddComponent<Image>(); obj.sprite = GUIManager.Instance.GetSprite("Background"); ((Graphic)obj).color = theme.TreeBackground; ((Graphic)obj).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 Func<TalentDefinition, string> _displayName; private Action<string> _onSelected; public bool IsDropdownVisible { get { if ((Object)(object)_dropdown != (Object)null) { return _dropdown.activeSelf; } return false; } } 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; } 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 (Input.GetKeyDown((KeyCode)274)) { _selectedSuggestionIndex = Mathf.Clamp(_selectedSuggestionIndex + 1, 0, GetVisibleSuggestionCount() - 1); ApplySuggestionHighlight(); } else if (Input.GetKeyDown((KeyCode)273)) { _selectedSuggestionIndex = Mathf.Clamp(_selectedSuggestionIndex - 1, 0, GetVisibleSuggestionCount() - 1); ApplySuggestionHighlight(); } else if (IsSubmitKeyDown()) { TrySelectCurrentSuggestion(); } else if (Input.GetKeyDown((KeyCode)27)) { 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) { //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) _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); } _selectedSuggestionIndex = 0; ApplySuggestionHighlight(); 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); } _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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0071: 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_00d0: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01b2: 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)val.transform).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 val2 = val.AddComponent<Button>(); ((Selectable)val2).transition = (Transition)0; SuggestionPointerDownCatcher suggestionPointerDownCatcher = val.AddComponent<SuggestionPointerDownCatcher>(); suggestionPointerDownCatcher.Owner = this; suggestionPointerDownCatcher.Index = count2; GameObject val3 = new GameObject("Label", new Type[2] { typeof(RectTransform), typeof(Text) }); val3.transform.SetParent(val.transform, false); UiFactory.SetRectStretch((RectTransform)val3.transform, new Vector2(_layout.SuggestionLabelPaddingX, 0f), new Vector2(0f - _layout.SuggestionLabelPaddingX, 0f)); Text component3 = val3.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 = val2, 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() { if (!Input.GetKeyDown((KeyCode)13)) { return Input.GetKeyDown((KeyCode)271); } return 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; public static RadialLayout.LayoutResult ApplyRadialLayout(TalentTreeView tree) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) string[] orderedIds = SectorRegistry.GetOrderedIds(); RadialLayout.LayoutResult layoutResult = RadialLayout.ComputePositionsNoOverlap(TalentRegistry.All, orderedIds, Layout.BaseRadius, Layout.RingSpacing, Layout.NodeSize, Layout.NodePadding, Layout.SectorPaddingDeg, Layout.SubRingSpacing, staggerRows: true, Layout.RingSpacingGrowth, Layout.RingIndexBase, Layout.OuterRingSpacingFactor, Layout.RingAngleOffsetDegPerRing, Layout.SectorStartOffsetDeg, 0f, 3, 0.5f, Layout.BorderSectorWidthDeg); 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_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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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) 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) { float num3 = Mathf.Max(0.01f, Layout.StartZoom); float num4 = (width - height) / num3; if (num4 > 0f) { num = TreeBaseSize + num4; } else { num2 = TreeBaseSize - num4; } } } 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) { AutoFitZoom = Mathf.Clamp(Mathf.Min(width2 / TreeBaseSize, height2 / TreeBaseSize) * 0.9f, 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; SectorLabelTracker sectorLabelTracker = (((parent != null) ? ((Component)parent).gameObject : null) ?? ((Component)view.ViewportRt).gameObject).AddComponent<SectorLabelTracker>(); sectorLabelTracker.Initialize(view.WorldRt, view.ViewportRt, view.ContentRt, layoutResult.SectorMidAngles, layoutResult.Positions, nodeRects); return sectorLabelTracker; } public static void RecalculateForViewport(TalentWindowView view) { //IL_003b: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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)) { float num = Mathf.Max(0.01f, Layout.StartZoom); float num2 = (width - height) / num; float num3 = ((num2 > 0f) ? (TreeBaseSize + num2) : TreeBaseSize); float num4 = ((num2 > 0f) ? TreeBaseSize : (TreeBaseSize - num2)); view.ContentRt.sizeDelta = new Vector2(num3, num4); if ((Object)(object)view.WorldRt != (Object)null) { view.WorldRt.sizeDelta = new Vector2(num3, num4); } AutoFitZoom = Mathf.Clamp(Mathf.Min(width / TreeBaseSize, height / TreeBaseSize) * 0.9f, Layout.MinZoom, Layout.MaxZoom); } } private static void SetupWorldLayer(RectTransform rt, float width, float height) { //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) 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 Action<string> <3>__OnNodeClicked; public static Action<string> <4>__OnNodeHoverEnter; public static Action<string> <5>__OnNodeHoverExit; public static Action<string> <6>__TryUnlockById; public static Action <7>__OnPanelClicked; public static Func<TalentDefinition, string> <8>__GetTalentDisplayName; public static Action<string> <9>__SelectTalent; } private static TalentWindowView _view; private static TalentTreeView _tree; private static TalentTreePathView _paths; private static TalentHoverTooltip _hoverTooltip; private static StatsPanelView _statsPanel; private static TalentSearchController _search; private static SectorLabelTracker _sectorTracker; private static Dictionary<string, RectTransform> _nodeRects; private static string _selectedId; private static bool _pinned; private static bool _statsOpen; private static int _nodeClickedFrame = -1; private static string _hoverCandidateId; private static float _hoverEnterAt; private static bool _hoverPreviewShown; 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 { get { if ((Object)(object)_view?.Root != (Object)null) { return _view.Root.activeSelf; } return false; } } 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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(); } } 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_008b: 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_0096: Expected O, but got Unknown EnsureGuiScaler(); _view = TalentWindowView.Build(); _view.ApplyLocalization(); 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); } JotunnLocalization.LocalizationUpdated += delegate { _view?.ApplyLocalization(); _statsPanel?.ApplyLocalization(); if (_search != null) { _search.RebuildIndex(TalentRegistry.All); } if (IsOpen) { Refresh(); } }; _tree = new TalentTreeView(); _tree.Build(_view.NodesRootRt); _tree.NodeClicked += OnNodeClicked; _tree.NodeHoverEnter += OnNodeHoverEnter; _tree.NodeHoverExit += 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.UnlockRequested += TryUnlockById; _hoverTooltip.Hide(); if ((Object)(object)_view.PanelClickCatcher != (Object)null) { _view.PanelClickCatcher.Clicked += OnPanelClicked; } _search = new TalentSearchController(_view.SearchInput, _view.SearchInputRt, _view.SearchDropdown, _view.SearchDropdownRt, TalentUiTheme.Default, Layout); _search.Bind(GetTalentDisplayName, SelectTalent); _search.RebuildIndex(TalentRegistry.All); ApplyZOrder(); } 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(); } } } private static void OnOpened() { _pinned = false; _selectedId = null; _statsOpen = false; _hoverCandidateId = null; _hoverPreviewShown = false; _hoverTooltip?.Hide(); _statsPanel?.SetVisible(visible: false); _tree?.ClearAllHighlights(); 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 Tick() { 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; } if (ZInput.GetKeyDown((KeyCode)27, true) || Input.GetKeyDown((KeyCode)27)) { if (_search != null && _search.IsDropdownVisible) { _search.HideDropdown(); } else { if (!_pinned) { Toggle(); return; } CloseAndUnpin(); } } _search?.Tick(); if (_hoverTooltip != null && _nodeRects != null) { string text = (_pinned ? _selectedId : _hoverCandidateId); if (!string.IsNullOrEmpty(text) && _nodeRects.TryGetValue(text, out var value)) { _hoverTooltip.UpdatePosition(value); } } if (!_pinned && !string.IsNullOrEmpty(_hoverCandidateId) && !_hoverPreviewShown && Time.unscaledTime - _hoverEnterAt >= Layout.HoverDelaySeconds) { ShowHoverPreview(_hoverCandidateId); _hoverPreviewShown = true; } } private static void OnNodeHoverEnter(string id) { if (!_pinned) { _hoverTooltip?.Hide(); _tree?.ClearAllHighlights(); _hoverCandidateId = id; _hoverEnterAt = Time.unscaledTime; _hoverPreviewShown = false; } } private static void OnNodeHoverExit(string id) { if (!_pinned && _hoverCandidateId == id) { _hoverCandidateId = null; _hoverPreviewShown = false; _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 talentRuntime = TalentRuntimeService.Get(Player.m_localPlayer); int value = 0; talentRuntime?.State.Ranks.TryGetValue(id, out value); bool canUnlock = talentRuntime != null && CanUnlock(talentRuntime, def); if (_nodeRects != null && _nodeRects.TryGetValue(id, out var value2)) { _hoverTooltip?.ShowFor(def, value2, value, canUnlock, pinned); } } } private static void OnNodeClicked(string id) { if (!((Object)(object)Player.m_localPlayer == (Object)null) && TalentRegistry.TryGet(id, out var _)) { _pinned = true; _selectedId = id; _hoverCandidateId = id; _hoverPreviewShown = true; _nodeClickedFrame = Time.frameCount; ShowHoverPreview(id, pinned: true); Refresh(); } } private static void SelectTalent(string id) { if (!string.IsNullOrEmpty(id)) { _hoverTooltip?.Hide(); _tree?.ClearAllHighlights(); CenterOnNode(id); OnNodeClicked(id); } } private static void CenterOnNode(string id) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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; } if (_nodeRects == null && _tree != null) { _nodeRects = _tree.GetNodeRects(); } if (_nodeRects != null && _nodeRects.TryGetValue(id, out var value) && !((Object)(object)value == (Object)null)) { float x = ((Transform)_view.ContentRt).localScale.x; Vector2 val = -value.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); _view.ContentRt.anchoredPosition = val; if ((Object)(object)_view.ScrollRect != (Object)null) { _view.ScrollRect.velocity = Vector2.zero; } } } private static void TryUnlockById(string id) { if (!((Object)(object)Player.m_localPlayer == (Object)null) && !string.IsNullOrEmpty(id) && TalentRegistry.TryGet(id, out var def)) { TalentRuntime talentRuntime = TalentRuntimeService.Get(Player.m_localPlayer); if (talentRuntime != null && CanUnlock(talentRuntime, def) && TalentUnlockService.TryUnlock(Player.m_localPlayer, id, out var _)) { Refresh(); } } } private 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); } private static void OnPanelClicked() { if (_pinned && _nodeClickedFrame != Time.frameCount) { CloseAndUnpin(); } } private static void CloseAndUnpin() { _pinned = false; _selectedId = null; _hoverCandidateId = null; _hoverPreviewShown = false; _hoverTooltip?.Hide(); _tree.ClearAllHighlights(); Refresh(); } 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() { 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 = JotunnLocalization.Format("tt_ui_points_format", availablePoints); } _tree.UpdateVisuals(talentRuntime, Player.m_localPlayer); _paths.UpdateVisuals(talentRuntime, Player.m_localPlayer); if (_statsOpen) { _statsPanel?.Refresh(talentRuntime); } if (_pinned && !string.IsNullOrEmpty(_selectedId)) { ShowHoverPreview(_selectedId, pinned: true); } } } private static string GetTalentDisplayName(TalentDefinition def) { if (def == null) { return string.Empty; } return JotunnLocalization.TranslateSmart(def.NameKey) ?? def.Id ?? string.Empty; } } 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //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) 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; public static Sprite GetWhiteSprite() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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 GetCircleMaskSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) <= num2) ? 1f : 0f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num5)); } } 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_001d: 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_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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0001: 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_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) //IL_001e: 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_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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) GameObject obj = CreateWoodPanel(parent, name, preset.AnchorMin, preset.AnchorMax, position, size, draggable); ApplyPivot(obj, preset.Pivot); return obj; } 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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0011: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GUIManager.Instance.CreateWoodpanel(parent, anchorMin, anchorMax, position, size.x, size.y, draggable); ((Object)obj).name = name; return obj; } 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_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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) 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) return CreateText(parent, name, text, Presets.TopRight, position, size, font, fontSize, color, outline, outlineColor); } public static (GameObject go, Text text) CreateText(Transform parent, string name, string text, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, Vector2 size, Font font, int fontSize, Color color, bool outline, Color outlineColor) { //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_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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GUIManager.Instance.CreateText(text, parent, anchorMin, anchorMax, position, font, fontSize, color, outline, outlineColor, size.x, size.y, false); ((Object)obj).name = name; return (go: obj, text: obj.GetComponent<Text>()); } public static (GameObject go, Button button, Text label) CreateButton(Transform parent, string name, string caption, RectPreset preset, Vector2 position, Vector2 size) { //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_0011: 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) var (val, item, item2) = CreateButton(parent, name, caption, preset.AnchorMin, preset.AnchorMax, position, size); ApplyPivot(val, preset.Pivot); return (go: val, button: item, label: item2); } public static (GameObject go, Button button, Text label) CreateButtonTopLeft(Transform parent, string name, string caption, Vector2 position, Vector2 size) { //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) return CreateButton(parent, name, caption, Presets.TopLeft, position, size); } public static (GameObject go, Button button, Text label) CreateButtonTopRight(Transform parent, string name, string caption, Vector2 position, Vector2 size) { //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) return CreateButton(parent, name, caption, Presets.TopRight, position, size); } public static (GameObject go, Button button, Text label) CreateButtonTopCenter(Transform parent, string name, string caption, Vector2 position, Vector2 size) { //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) return CreateButton(parent, name, caption, Presets.TopCenter, position, size); } public static (GameObject go, Button button, Text label) CreateButtonBottomCenter(Transform parent, string name, string caption, Vector2 position, Vector2 size) { //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) return CreateButton(parent, name, caption, Presets.BottomCenter, position, size); } public static (GameObject go, Button button, Text label) CreateButton(Transform parent, string name, string caption, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, Vector2 size) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) GameObject val = GUIManager.Instance.CreateButton(caption, parent, anchorMin, anchorMax, position, size.x, size.y); ((Object)val).name = name; Button item = val.GetComponent<Button>() ?? val.GetComponentInChildren<Button>(true); Text componentInChildren = val.GetComponentInChildren<Text>(true); return (go: val, button: item, label: componentInChildren); } public static RectTransform SetRectStretch(RectTransform rt, Vector2 offsetMin, Vector2 offsetMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.pivot = new Vector2(0.5f, 0.5f); rt.offsetMin = offsetMin; rt.offsetMax = offsetMax; return rt; } public static RectTransform SetStretchXTop(RectTransform rt, float left, float right, float top, float height) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = new Vector2(0f, 1f); rt.anchorMax = new Vector2(1f, 1f); rt.pivot = new Vector2(0.5f, 1f); rt.offsetMin = new Vector2(left, 0f - (top + height)); rt.offsetMax = new Vector2(0f - right, 0f - top); return rt; } public static RectTransform SetStretchYRight(RectTransform rt, float width, float marginRight, float marginTop, float marginBottom) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = new Vector2(1f, 0f); rt.anchorMax = new Vector2(1f, 1f); rt.pivot = new Vector2(1f, 0.5f); rt.sizeDelta = new Vector2(width, 0f); rt.offsetMin = new Vector2(0f - (width + marginRight), marginBottom); rt.offsetMax = new Vector2(0f - marginRight, 0f - marginTop); return rt; } public static (GameObject go, Text text) CreateTextStretchXTop(Transform parent, string name, string text, float left, float right, float top, float height, Font font, int fontSize, Color color, bool outline, Color outlineColor, Vector2 dummySize) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) var (val, item) = CreateText(parent, name, text, Presets.StretchXTop, Vector2.zero, dummySize, font, fontSize, color, outline, outlineColor); SetStretchXTop(val.GetComponent<RectTransform>(), left, right, top, height); return (go: val, text: item); } } internal sealed class UpdateLoopRunner : MonoBehaviour { public Action Tick; private void Update() { Tick?.Invoke(); } } internal sealed class MouseWheelZoomToCursor : MonoBehaviour, IScrollHandler, IEventSystemHandler { private RectTransform _viewport; private RectTransform _content; public float MinScale { get; private set; } public float MaxScale { get; private set; } public float ZoomFactorPerStep { get; private set; } public float WheelDeadzone { get; private set; } public void Initialize(RectTransform viewport, RectTransform content, ScrollRect scrollRect = null, TalentUiLayout layout = null) { layout = layout ?? TalentUiLayout.Default; Initialize(viewport, content, scrollRect, layout.MinZoom, layout.MaxZoom, layout.ZoomFactorPerStep, layout.MouseWheelDeadzone); } public void Initialize(RectTransform viewport, RectTransform content, ScrollRect scrollRect, float minScale, float maxScale, float zoomFactorPerStep, float wheelDeadzone) { _viewport = viewport; _content = content; MinScale = minScale; MaxScale = maxScale; ZoomFactorPerStep = zoomFactorPerStep; WheelDeadzone = wheelDeadzone; if ((Object)(object)scrollRect != (Object)null) { scrollRect.scrollSensitivity = 0f; } } public void SetScale(float scale) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_content == (Object)null)) { float num = Mathf.Clamp(scale, MinScale, MaxScale); ((Transform)_content).localScale = new Vector3(num, num, 1f); } } public void OnScroll(PointerEventData eventData) { //IL_001e: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_viewport == (Object)null || (Object)(object)_content == (Object)null) { return; } float y = eventData.scrollDelta.y; if (!(Mathf.Abs(y) < WheelDeadzone)) { float x = ((Transform)_content).localScale.x; float num = ((y > 0f) ? (1f + ZoomFactorPerStep) : (1f - ZoomFactorPerStep)); float num2 = Mathf.Clamp(x * num, MinScale, MaxScale); if (!Mathf.Approximately(num2, x)) { Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(_viewport, eventData.position, eventData.pressEventCamera, ref val); float num3 = num2 / x; Vector2 anchoredPosition = val + (_content.anchoredPosition - val) * num3; ((Transform)_content).localScale = new Vector3(num2, num2, 1f); _content.anchoredPosition = anchoredPosition; } } } } internal sealed class PanelClickCatcher : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public event Action Clicked; public void OnPointerClick(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)eventData.button == 0) { this.Clicked?.Invoke(); } } } public struct SectorRingKey : IEquatable<SectorRingKey> { public string SectorId; public int Ring; public bool Equals(SectorRingKey other) { if (SectorId == other.SectorId) { return Ring == other.Ring; } return false; } public override bool Equals(object obj) { if (obj is SectorRingKey other) { return Equals(other); } return false; } public override int GetHashCode() { return ((SectorId?.GetHashCode() ?? 0) * 397) ^ Ring; } } public static class RadialLayout { public sealed class LayoutResult { public sealed class RingInfo { public int NodeCount; public int Capacity; public int Rows; public float[] RowRadii = Array.Empty<float>(); } public readonly Dictionary<string, Vector2> Positions = new Dictionary<string, Vector2>(); public readonly Dictionary<string, float> SectorMidAngles = new Dictionary<string, float>(); public float MaxRadius; public readonly Dictionary<SectorRingKey, RingInfo> Rings = new Dictionary<SectorRingKey, RingInfo>(); } private const float FullCircleDeg = 360f; private const float MinSectorSpanDeg = 5f; public static List<SectorLayout> BuildDefaultSectors(string[] ids, float startOffsetDeg = 0f, float borderSectorWidthDeg = 15f) { List<SectorLayout> list = new List<SectorLayout>(); if (ids == null || ids.Length == 0) { return list; } int num = 0; for (int i = 0; i < ids.Length; i++) { SectorDefinition sectorDefinition = SectorRegistry.Get(ids[i]); if (sectorDefinition == null || !sectorDefinition.IsBorderSector) { num++; } } float num2 = ((num > 0) ? (360f / (float)num) : 0f); float num3 = startOffsetDeg; SectorLayout sectorLayout = null; for (int j = 0; j < ids.Length; j++) { SectorDefinition sectorDefinition2 = SectorRegistry.Get(ids[j]); if (sectorDefinition2 == null || !sectorDefinition2.IsBorderSector) { SectorLayout sectorLayout2 = new SectorLayout { SectorId = ids[j], StartAngleDeg = num3, EndAngleDeg = num3 + num2 }; list.Add(sectorLayout2); sectorLayout = sectorLayout2; num3 += num2; } else { float num4 = Mathf.Min(borderSectorWidthDeg, num2 * 0.5f); float num5 = sectorLayout?.EndAngleDeg ?? num3; SectorLayout item = new SectorLayout { SectorId = ids[j], StartAngleDeg = num5 - num4 * 0.5f, EndAngleDeg = num5 + num4 * 0.5f }; list.Add(item); } } return list; } public static SectorLayout FindSector(List<SectorLayout> sectors, string sectorId) { for (int i = 0; i < sectors.Count; i++) { if (sectors[i].SectorId == sectorId) { return sectors[i]; } } return null; } private static float FindEffectiveEndDeg(SectorLayout sector, List<SectorLayout> allSectors, float padding) { float num = sector.EndAngleDeg - padding; for (int i = 0; i < allSectors.Count; i++) { SectorLayout sectorLayout = allSectors[i]; if (!(sectorLayout.SectorId == sector.SectorId)) { SectorDefinition sectorDefinition = SectorRegistry.Get(sectorLayout.SectorId); if (sectorDefinition != null && sectorDefinition.IsBorderSector && sectorLayout.StartAngleDeg > sector.StartAngleDeg && sectorLayout.StartAngleDeg < sector.EndAngleDeg) { num = Mathf.Min(num, sectorLayout.StartAngleDeg - padding); } } } return num; } private static float FindEffectiveStartDeg(SectorLayout sector, List<SectorLayout> allSectors, float padding) { float num = sector.StartAngleDeg + padding; for (int i = 0; i < allSectors.Count; i++) { SectorLayout sectorLayout = allSectors[i]; if (!(sectorLayout.SectorId == sector.SectorId)) { SectorDefinition sectorDefinition = SectorRegistry.Get(sectorLayout.SectorId); if (sectorDefinition != null && sectorDefinition.IsBorderSector && sectorLayout.EndAngleDeg > sector.StartAngleDeg && sectorLayout.EndAngleDeg < sector.EndAngleDeg) { num = Mathf.Max(num, sectorLayout.EndAngleDeg + padding); } } } return num; } public static Dictionary<SectorRingKey, List<TalentDefinition>> GroupBySectorRing(IEnumerable<TalentDefinition> defs) { Dictionary<SectorRingKey, List<TalentDefinition>> dictionary = new Dictionary<SectorRingKey, List<TalentDefinition>>(); foreach (TalentDefinition def in defs) { SectorRingKey key = new SectorRingKey { SectorId = def.GetEffectiveLayoutSectorId(), Ring = def.Ring }; if (!dictionary.TryGetValue(key, out var value)) { value = (dictionary[key] = new List<TalentDefinition>()); } value.Add(def); } return dictionary; } private static int GetGlobalMaxRing(Dictionary<SectorRingKey, List<TalentDefinition>> grouped) { int num = 0; foreach (SectorRingKey key in grouped.Keys) { num = Mathf.Max(num, key.Ring); } return num; } private static float ComputeRingRadius(float baseRadius, float ringSpacing, float ringSpacingGrowth, int ring, int ringIndexBase, int globalMaxRing, float outerRingSpacingFactor) { int num = Mathf.Max(0, ring - ringIndexBase); if (num == 0) { return baseRadius; } int num2 = Mathf.Max(1, globalMaxRing - ringIndexBase); float num3 = baseRadius; for (int i = 0; i < num; i++) { float num4 = ((num2 <= 1) ? 0f : ((float)i / (float)(num2 - 1))); float num5 = Mathf.Lerp(1f, outerRingSpacingFactor, num4); num3 += ringSpacing * num5; } if (ringSpacingGrowth != 0f) { num3 += ringSpacingGrowth * (float)num * (float)num; } return num3; } private static Vector2 PlaceOnArc(float angleDeg, float radius) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) float num = angleDeg * ((float)Math.PI / 180f); return new Vector2(Mathf.Cos(num) * radius, Mathf.Sin(num) * radius); } public static LayoutResult ComputePositionsNoOverlap(IEnumerable<TalentDefinition> defs, string[] sectorOrder, float baseRadius, float ringSpacing, float nodeSize, float nodePadding, float sectorPaddingDeg, float subRingSpacing, bool staggerRows, float ringSpacingGrowth, int ringIndexBase, float outerRingSpacingFactor, float ringAngleOffsetDegPerRing, float sectorStartOffsetDeg = 0f, float overlapMinDistance = 0f, int overlapIterations = 3, float overlapPushStrength = 0.5f, float borderSectorWidthDeg = 15f) { //IL_018e: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) LayoutResult layoutResult = new LayoutResult(); if (defs == null) { return layoutResult; } List<SectorLayout> list = BuildDefaultSectors(sectorOrder ?? Array.Empty<string>(), sectorStartOffsetDeg, borderSectorWidthDeg); Dictionary<SectorRingKey, List<TalentDefinition>> dictionary = GroupBySectorRing(defs); int globalMaxRing = GetGlobalMaxRing(dictionary); foreach (SectorLayout item in list) { layoutResult.SectorMidAngles[item.SectorId] = (item.StartAngleDeg + item.EndAngleDeg) * 0.5f; } float num = nodeSize * 0.5f; foreach (KeyValuePair<SectorRingKey, List<TalentDefinition>> item2 in dictionary) { SectorRingKey key = item2.Key; SectorLayout sectorLayout = FindSector(list, key.SectorId); if (sectorLayout == null) { continue; } List<TalentDefinition> value = item2.Value; value.Sort((TalentDefinition a, TalentDefinition b) => a.Order.CompareTo(b.Order)); float num2 = ComputeRingRadius(baseRadius, ringSpacing, ringSpacingGrowth, key.Ring, ringIndexBase, globalMaxRing, outerRingSpacingFactor); SectorDefinition sectorDefinition = SectorRegistry.Get(key.SectorId); float num3; float num4; float num5; if (sectorDefinition != null && sectorDefinition.IsBorderSector) { num3 = sectorLayout.StartAngleDeg; num4 = sectorLayout.EndAngleDeg; num5 = (num3 + num4) * 0.5f; } else { num3 = FindEffectiveStartDeg(sectorLayout, list, sectorPaddingDeg); num4 = FindEffectiveEndDeg(sectorLayout, list, sectorPaddingDeg); num5 = (sectorLayout.StartAngleDeg + sectorLayout.EndAngleDeg) * 0.5f; } if (value.Count == 1) { TalentDefinition talentDefinition = value[0]; Vector2 value2 = PlaceOnArc(num5, num2); layoutResult.Positions[talentDefinition.Id] = value2; layoutResult.MaxRadius = Mathf.Max(layoutResult.MaxRadius, num2 + num); layoutResult.Rings[key] = new LayoutResult.RingInfo { NodeCount = 1, Capacity = 1, Rows = 1, RowRadii = new float[1] { num2 } }; continue; } float num6 = Mathf.Max(5f, num4 - num3) * ((float)Math.PI / 180f); float num7 = Mathf.Max(1f, num2 * num6); float num8 = Mathf.Max(1f, nodeSize + nodePadding); int num9 = Mathf.Max(1, Mathf.FloorToInt(num7 / num8)); int count = value.Count; int num10 = Mathf.Max(1, Mathf.CeilToInt((float)count / (float)num9)); float[] array = new float[num10]; for (int num11 = 0; num11 < num10; num11++) { array[num11] = num2 + (float)num11 * subRingSpacing; } layoutResult.Rings[key] = new LayoutResult.RingInfo { NodeCount = count, Capacity = num9, Rows = num10, RowRadii = array }; int num12 = 0; for (int num13 = 0; num13 < num10; num13++) { int num14 = count - num12; int num15 = num10 - num13; int num16 = Mathf.Clamp(Mathf.CeilToInt((float)num14 / (float)num15), 1, num9); float num17 = num2 + (float)num13 * subRingSpacing; float num18 = (num3 + num4) * 0.5f; float num19 = num5 - num18; for (int num20 = 0; num20 < num16; num20++) { TalentDefinition talentDefinition2 = value[num12++]; float num21 = (float)(num12 - 1 + 1) / (float)(count + 1); Vector2 value3 = PlaceOnArc(Mathf.Clamp(Mathf.Lerp(num3, num4, num21) + num19, num3, num4), num17); layoutResult.Positions[talentDefinition2.Id] = value3; layoutResult.MaxRadius = Mathf.Max(layoutResult.MaxRadius, num17 + num); } } } return layoutResult; } } public sealed class SectorLayout { public string SectorId; public float StartAngleDeg; public float EndAngleDeg; public float SpanDeg => EndAngleDeg - StartAngleDeg; } internal sealed class TalentUiLayout { public float WindowScreenFillRatio = 0.92f; public Vector2 TitleOffset = new Vector2(0f, -30f); public Vector2 TitleSize = new Vector2(500f, 40f); public int TitleFontSize = 28; public Vector2 CloseButtonOffset = new Vector2(-20f, -20f); public Vector2 CloseButtonSize = new Vector2(40f, 40f); public Vector2 PointsOffset = new Vector2(30f, -30f); public Vector2 PointsSize = new Vector2(320f, 30f); public int PointsFontSize = 16; public Vector2 StatsButtonOffset = new Vector2(380f, -30f); public Vector2 StatsButtonSize = new Vector2(70f, 28f); public Vector2 SearchOffset = new Vector2(-305f, -30f); public Vector2 SearchSize = new Vector2(220f, 34f); public int SearchFontSize = 16; public int SearchCharacterLimit = 64; public float SearchDropdownInitialHeight = 10f; public float SearchTextPaddingX = 10f; public float SearchTextPaddingY = 6f; public float SearchDropdownGap = 6f; public int SearchDropdownPadding = 8; public int SearchDropdownSpacing = 4; public int SearchMaxSuggestions = 10; public float SuggestionRowHeight = 26f; public float SuggestionLabelPaddingX = 10f; public int SuggestionFontSize = 14; public Vector2 TreeAreaPaddingMin = new Vector2(20f, 20f); public Vector2 TreeAreaPaddingMax = new Vector2(-20f, -70f); public Vector2 ViewportPaddingMin = new Vector2(10f, 10f); public Vector2 ViewportPaddingMax = new Vector2(-10f, -10f); public Vector2 ContentSize = new Vector2(3600f, 3600f); public float StartZoom = 0.13f; public float MinZoom = 0.13f; public float MaxZoom = 0.13f; public float ZoomFactorPerStep; public float NodeSize = 700f; public float NodeIconPadding = 120f; public float NodeIconMinSize = 4f; public float NodeFrameThickness = 28f; public int NodeButtonStyleFontSize = 16; public float NodeScaleAnimationSpeed = 16f; public float NodeScaleMin = 0.5f; public float NodeScaleMax = 3f; public float SelectedNodeScale = 1.6f; public float MinorNodeSize = 220f; public float MinorNodeIconPadding = 12f; public float MinorNodeFrameThickness = 28f; public float EdgeBorderThickness = 70f; public float EdgeInnerThickness = 40f; public float EdgeMinLength = 20f; public float BaseRadius = 800f; public float RingSpacing = 1200f; public float OuterRingSpacingFactor = 0.7f; public float RingSpacingGrowth; public float SubRingSpacing = 380f; public float NodePadding = 120f; public float SectorPaddingDeg = 2f; public float BorderSectorWidthDeg = 5f; public float SectorStartOffsetDeg = -30f; public int RingIndexBase = 1; public float RingAngleOffsetDegPerRing; public int SectorLabelFontSize = 36; public float SectorLabelOffset = 3000f; public float SectorLabelViewportEdgePadding = 24f; public float SectorLabelShowMarginFactor = 1.05f; public float SectorLabelFadeSpeed = 6f; public float SectorLabelSmoothingSpeed = 12f; public float SectorLabelAnchorClearancePadding = 14f; public int BezierSegments = 24; public float BezierCurvature = 0.1f; public float OverlapMinDistance; public int OverlapIterations = 3; public float OverlapPushStrength = 0.5f; public float WorldPadding = 1200f; public float MinWorldSize = 3600f; public float DescriptionPanelWidth = 380f; public float DescriptionPanelMarginRight = 20f; public float DescriptionPanelMarginTop = 70f; public float DescriptionPanelMarginBottom = 20f; public float DescriptionPanelPadding = 16f; public float DescriptionTitleCloseGap = 6f; public float DescriptionAfterTitleGap = 2f; public float DescriptionCloseSize = 34f; public int DescriptionTitleFontSize = 27; public float DescriptionTitleHeight = 40f; public float DescriptionRankStarsHeight = 40f; public float DescriptionTextHeight = 180f; public float DescriptionGap = 10f; public float DescriptionUnlockHeight = 44f; public float DescriptionUnlockWidth = 240f; public int DescriptionRankStarsFontSize = 28; public int DescriptionBodyFontSize = 14; public float DescriptionRankRowHeight = 22f; public float DescriptionRankRowGap = 4f; public float StretchDummySize = 10f; public float HoverDelaySeconds = 0.15f; public float HoverTooltipWidth = 300f; public float HoverTooltipMinHeight = 72f; public float HoverTooltipMaxHeight = 480f; public float HoverTooltipPadding = 12f; public float HoverTooltipTitleHeight = 26f; public float HoverTooltipTitleSpacing = 6f; public float HoverTooltipMinBodyHeight = 20f; public float HoverTooltipClampMargin = 6f; public int HoverTooltipTitleFontSize = 18; public int HoverTooltipBodyFontSize = 14; public float HoverTooltipStarsWidth = 70f; public float HoverTooltipTitleStarsGap = 6f; public Vector2 HoverTooltipOffsetFromNode = new Vector2(0f, 20f); public int HoverTooltipMaxBodyLines = 6; public int HoverTooltipMaxChars = 260; public float HoverTooltipRankHeight = 20f; public float HoverTooltipRankSpacing = 4f; public float HoverTooltipUnlockHeight = 34f; public float HoverTooltipUnlockGap = 8f; public float HoverTooltipSeparatorHeight = 1f; public float HoverTooltipSeparatorGap = 8f; public float HoverTooltipRankRowHeight = 22f; public float HoverTooltipRankRowGap = 4f; public float StatsPanelWidth = 280f; public float StatsPanelPaddingH = 12f; public float StatsPanelPaddingV = 10f; public float StatsPanelTitleHeight = 26f; public float StatsPanelSepHeight = 1f; public float StatsPanelSepGap = 5f; public float StatsPanelRowHeight = 22f; public float StatsPanelRowSpacing = 4f; public float StatsPanelValueWidth = 80f; public int StatsPanelTitleFontSize = 16; public int StatsPanelRowFontSize = 16; public float MouseWheelDeadzone = 0.001f; public static TalentUiLayout Default { get; } = new TalentUiLayout(); } [DefaultExecutionOrder(1000)] public sealed class SectorLabelTracker : MonoBehaviour { private sealed class SectorLabel { public string SectorId; public Color Accent; public RectTransform Rt; public Text Text; public CanvasGroup Cg; public float MidAngleDeg; public Vector2 AnchorWorldLocal; public Vector2 BoundsMinWorldLocal; public Vector2 BoundsMaxWorldLocal; } private RectTransform _worldRt; private RectTransform _viewportRt; private RectTransform _contentRt; private RectTransform _overlayRt; private int _baseFontSize; private float _labelOffset; private float _edgePadding; private float _showMarginFactor; private float _fadeSpeed; private float _smoothingSpeed; private float _anchorClearancePadding; private readonly List<SectorLabel> _labels = new List<SectorLabel>(); public void Initialize(RectTransform worldRt, RectTransform viewportRt, RectTransform contentRt, Dictionary<string, float> sectorMidAngles, Dictionary<string, Vector2> nodePositions, Dictionary<string, RectTransform> nodeRects) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) _worldRt = worldRt; _viewportRt = viewportRt; _contentRt = contentRt; if ((Object)(object)_worldRt == (Object)null || (Object)(object)_viewportRt == (Object)null || (Object)(object)_contentRt == (Object)null) { return; } TalentUiLayout talentUiLayout = TalentUiLayout.Default; _baseFontSize = talentUiLayout.SectorLabelFontSize; _labelOffset = talentUiLayout.SectorLabelOffset; _edgePadding = talentUiLayout.SectorLabelViewportEdgePadding; _showMarginFactor = talentUiLayout.SectorLabelShowMarginFactor; _fadeSpeed = talentUiLayout.SectorLabelFadeSpeed; _smoothingSpeed = talentUiLayout.SectorLabelSmoothingSpeed; _anchorClearancePadding = talentUiLayout.SectorLabelAnchorClearancePadding; Cleanup(); EnsureOverlay(); Dictionary<string, float> dictionary = new Dictionary<string, float>(StringComparer.OrdinalIgnoreCase); Dictionary<string, Vector2> dictionary2 = new Dictionary<string, Vector2>(StringComparer.OrdinalIgnoreCase); Dictionary<string, Vector2> dictionary3 = new Dictionary<string, Vector2>(StringComparer.OrdinalIgnoreCa