Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of CookBook v1.1.1
CookBook.dll
Decompiled 5 hours 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.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using RoR2.ContentManagement; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CookBook")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+94b4a23338ba4b4bd84426e9d92e2792b5135865")] [assembly: AssemblyProduct("CookBook")] [assembly: AssemblyTitle("CookBook")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CookBook { internal sealed class CraftPlanner { internal sealed class CraftableEntry { public int ResultIndex; public int ResultCount; public int MinDepth; public List<RecipeChain> Chains = new List<RecipeChain>(); public bool IsItem => ResultIndex < ItemCatalog.itemCount; public ItemIndex ResultItem { get { if (IsItem) { return (ItemIndex)ResultIndex; } return (ItemIndex)(-1); } } public EquipmentIndex ResultEquipment { get { if (IsItem) { return (EquipmentIndex)(-1); } return (EquipmentIndex)(ResultIndex - ItemCatalog.itemCount); } } public bool IsEquipment => !IsItem; } internal sealed class RecipeChain { private readonly long _canonicalSignature; internal IReadOnlyList<ChefRecipe> Steps { get; } internal int Depth => Steps.Count; internal int[] TotalCost { get; } internal int ResultCount { get; } internal RecipeChain(List<ChefRecipe> steps, int[] totalCost, long signature) { Steps = steps.ToArray(); TotalCost = totalCost; ResultCount = ((steps.Count <= 0) ? 1 : Math.Max(1, steps[0].ResultCount)); _canonicalSignature = signature; } internal static long CalculateCanonicalSignature(IReadOnlyList<ChefRecipe> chain) { if (chain == null || chain.Count == 0) { return 3735928559L; } List<int> list = new List<int>(chain.Count); foreach (ChefRecipe item in chain) { list.Add(item.GetHashCode()); } list.Sort(); long num = 17L; foreach (int item2 in list) { num = num * 31 + item2; } return num; } } internal sealed class PlanEntry { public ResultKey Result { get; } internal List<RecipeChain> Chains { get; } = new List<RecipeChain>(); public HashSet<long> CanonicalSignatures { get; } = new HashSet<long>(); internal PlanEntry(ResultKey result) { Result = result; } } internal readonly struct ResultKey : IEquatable<ResultKey> { public readonly int Index; public bool IsItem => Index < ItemCatalog.itemCount; public ItemIndex Item { get { if (IsItem) { return (ItemIndex)Index; } return (ItemIndex)(-1); } } public EquipmentIndex Equipment { get { if (IsItem) { return (EquipmentIndex)(-1); } return (EquipmentIndex)(Index - ItemCatalog.itemCount); } } public ResultKey(int index) { Index = index; } public bool Equals(ResultKey other) { return Index == other.Index; } public override bool Equals(object obj) { if (obj is ResultKey other) { return Equals(other); } return false; } public override int GetHashCode() { return Index; } } private readonly IReadOnlyList<ChefRecipe> _recipes; private readonly int _itemCount; private readonly int _totalDefCount; private int _maxDepth; private readonly ManualLogSource _log; private int[] _bufExternalCost; private int[] _bufCurrentState; private readonly Dictionary<ResultKey, List<ChefRecipe>> _recipesByResult = new Dictionary<ResultKey, List<ChefRecipe>>(); private readonly Dictionary<ResultKey, PlanEntry> _plans = new Dictionary<ResultKey, PlanEntry>(); public int SourceItemCount { get; } internal IReadOnlyDictionary<ResultKey, PlanEntry> Plans => _plans; internal event Action<List<CraftableEntry>> OnCraftablesUpdated; public CraftPlanner(IReadOnlyList<ChefRecipe> recipes, int maxDepth, ManualLogSource log) { _recipes = recipes ?? throw new ArgumentNullException("recipes"); _maxDepth = maxDepth; _itemCount = ItemCatalog.itemCount; _totalDefCount = _itemCount + EquipmentCatalog.equipmentCount; _log = log; SourceItemCount = ItemCatalog.itemCount; RebuildAllPlans(); } internal void SetMaxDepth(int newDepth) { if (newDepth < 0) { newDepth = 0; } if (newDepth != _maxDepth) { _maxDepth = newDepth; RebuildAllPlans(); } } internal void RebuildAllPlans() { Stopwatch stopwatch = Stopwatch.StartNew(); BuildRecipeIndex(); BuildPlans(); stopwatch.Stop(); _log.LogInfo((object)$"CraftPlanner: Built plans for {_plans.Count} results."); _log.LogInfo((object)$"CraftPlanner: RebuildAllPlans completed in {stopwatch.ElapsedMilliseconds}ms"); } private void BuildRecipeIndex() { _recipesByResult.Clear(); foreach (ChefRecipe recipe in _recipes) { ResultKey key = new ResultKey(recipe.ResultIndex); if (!_recipesByResult.TryGetValue(key, out var value)) { value = new List<ChefRecipe>(); _recipesByResult[key] = value; } value.Add(recipe); } } private void BuildPlans() { _plans.Clear(); HashSet<ResultKey> stack = new HashSet<ResultKey>(); foreach (KeyValuePair<ResultKey, List<ChefRecipe>> item in _recipesByResult) { ResultKey key = item.Key; PlanEntry planEntry = new PlanEntry(key); EnumerateChainsForTarget(key, planEntry, stack); if (planEntry.Chains.Count > 0) { _plans[key] = planEntry; } } } private void EnumerateChainsForTarget(ResultKey target, PlanEntry plan, HashSet<ResultKey> stack) { stack.Clear(); List<ChefRecipe> chain = new List<ChefRecipe>(); DFS(target, target, 0, chain, stack, plan); } private void DFS(ResultKey current, ResultKey rootTarget, int depth, List<ChefRecipe> chain, HashSet<ResultKey> stack, PlanEntry plan) { if (depth >= _maxDepth || !_recipesByResult.TryGetValue(current, out var value)) { return; } bool flag = stack.Contains(current); if (!flag) { stack.Add(current); } foreach (ChefRecipe item in value) { if (IsCycle1Recipe(item)) { continue; } chain.Add(item); TryFinalizeChain(chain, plan, rootTarget); if (!flag) { Ingredient[] ingredients = item.Ingredients; for (int i = 0; i < ingredients.Length; i++) { Ingredient ingredient = ingredients[i]; ResultKey current3 = new ResultKey(ingredient.UnifiedIndex); DFS(current3, rootTarget, depth + 1, chain, stack, plan); } } chain.RemoveAt(chain.Count - 1); } if (!flag) { stack.Remove(current); } } private void TryFinalizeChain(List<ChefRecipe> chain, PlanEntry plan, ResultKey targetKey) { if (chain.Count == 0) { return; } int[] cleanBuffer = GetCleanBuffer(ref _bufExternalCost, _totalDefCount); int[] cleanBuffer2 = GetCleanBuffer(ref _bufCurrentState, _totalDefCount); bool flag = false; for (int num = chain.Count - 1; num >= 0; num--) { ChefRecipe chefRecipe = chain[num]; Ingredient[] ingredients = chefRecipe.Ingredients; for (int i = 0; i < ingredients.Length; i++) { Ingredient ingredient = ingredients[i]; int count = ingredient.Count; int unifiedIndex = ingredient.UnifiedIndex; if (cleanBuffer2[unifiedIndex] < count) { int num2 = count - cleanBuffer2[unifiedIndex]; cleanBuffer[unifiedIndex] += num2; cleanBuffer2[unifiedIndex] += num2; flag = true; } cleanBuffer2[unifiedIndex] -= count; } cleanBuffer2[chefRecipe.ResultIndex] += chefRecipe.ResultCount; } int index = targetKey.Index; int num3 = cleanBuffer2[index]; int num4 = cleanBuffer[index]; if (num3 - num4 > 0 && flag) { long num5 = RecipeChain.CalculateCanonicalSignature(chain); if (!plan.CanonicalSignatures.Contains(num5)) { int[] array = new int[_totalDefCount]; Array.Copy(cleanBuffer, array, _totalDefCount); RecipeChain item = new RecipeChain(chain, array, num5); plan.CanonicalSignatures.Add(num5); plan.Chains.Add(item); } } } public void ComputeCraftable(int[] unifiedStacks) { if (unifiedStacks == null || unifiedStacks.Length != _totalDefCount) { return; } List<CraftableEntry> list = new List<CraftableEntry>(); List<RecipeChain> list2 = new List<RecipeChain>(); foreach (var (rk, planEntry2) in _plans) { list2.Clear(); foreach (RecipeChain chain in planEntry2.Chains) { if (CanAffordChain(unifiedStacks, chain)) { list2.Add(chain); } } if (list2.Count == 0) { continue; } list2.Sort(delegate(RecipeChain a, RecipeChain b) { int num2 = a.ResultCount.CompareTo(b.ResultCount); return (num2 != 0) ? num2 : a.Depth.CompareTo(b.Depth); }); int num = -1; List<RecipeChain> list3 = new List<RecipeChain>(); foreach (RecipeChain item in list2) { if (item.ResultCount != num) { if (list3.Count > 0) { EmitCraftableGroup(list, rk, num, list3); } num = item.ResultCount; list3.Clear(); } list3.Add(item); } if (list3.Count > 0) { EmitCraftableGroup(list, rk, num, list3); } } list.Sort(TierManager.CompareCraftableEntries); this.OnCraftablesUpdated?.Invoke(list); } private bool CanAffordChain(int[] currentInventory, RecipeChain chain) { int[] totalCost = chain.TotalCost; for (int i = 0; i < totalCost.Length; i++) { if (totalCost[i] > 0 && currentInventory[i] < totalCost[i]) { return false; } } return true; } private static void EmitCraftableGroup(List<CraftableEntry> result, ResultKey rk, int count, List<RecipeChain> group) { result.Add(new CraftableEntry { ResultIndex = rk.Index, ResultCount = count, MinDepth = group[0].Depth, Chains = new List<RecipeChain>(group) }); } private bool IsCycle1Recipe(ChefRecipe recipe) { Ingredient[] ingredients = recipe.Ingredients; for (int i = 0; i < ingredients.Length; i++) { if (ingredients[i].UnifiedIndex == recipe.ResultIndex) { return true; } } return false; } private static int[] GetCleanBuffer(ref int[] buffer, int requiredSize) { if (buffer == null || buffer.Length != requiredSize) { buffer = new int[requiredSize]; } else { Array.Clear(buffer, 0, buffer.Length); } return buffer; } } internal static class CraftUI { internal sealed class RecipeRowRuntime : MonoBehaviour { public CraftPlanner.CraftableEntry Entry; public RectTransform RowTransform; public LayoutElement RowLayoutElement; public RectTransform RowTop; public Button RowTopButton; public TextMeshProUGUI ArrowText; public RectTransform DropdownMountPoint; public LayoutElement DropdownLayoutElement; public Image ResultIcon; public TextMeshProUGUI ResultStackText; public TextMeshProUGUI ItemLabel; public TextMeshProUGUI DepthText; public TextMeshProUGUI PathsText; public bool IsExpanded; public float CollapsedHeight; private void OnDestroy() { if ((Object)(object)RowTopButton != (Object)null) { ((UnityEventBase)RowTopButton.onClick).RemoveAllListeners(); } Entry = null; if ((Object)(object)_openRow == (Object)(object)this) { _openRow = null; } } } internal sealed class PathRowRuntime : MonoBehaviour { internal RecipeRowRuntime OwnerRow; internal CraftPlanner.RecipeChain Chain; internal Image BackgroundImage; public RectTransform VisualRect; public Button pathButton; public EventTrigger buttonEvent; private ColorFaderRuntime fader; private bool isSelected; private bool isHovered; private const float FadeDuration = 0.1f; private static readonly Color Col_BG_Normal = Color32.op_Implicit(new Color32((byte)26, (byte)26, (byte)26, (byte)50)); private static readonly Color Col_BG_Active = Color32.op_Implicit(new Color32((byte)206, (byte)198, (byte)143, (byte)200)); private static readonly Color Col_BG_Hover = Color32.op_Implicit(new Color32((byte)206, (byte)198, (byte)143, (byte)75)); private void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0093: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown if ((Object)(object)pathButton == (Object)null) { pathButton = ((Component)this).GetComponent<Button>(); } if ((Object)(object)buttonEvent == (Object)null) { buttonEvent = ((Component)this).GetComponent<EventTrigger>(); } if ((Object)(object)pathButton != (Object)null) { ((UnityEvent)pathButton.onClick).AddListener(new UnityAction(OnClicked)); } Entry val = new Entry { eventID = (EventTriggerType)0 }; ((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate { OnHighlightChanged(isHighlighted: true); }); buttonEvent.triggers.Add(val); Entry val2 = new Entry { eventID = (EventTriggerType)1 }; ((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate { OnHighlightChanged(isHighlighted: false); }); buttonEvent.triggers.Add(val2); if ((Object)(object)VisualRect == (Object)null) { Transform val3 = ((Component)this).transform.Find("Visuals"); if ((Object)(object)val3 != (Object)null) { VisualRect = ((Component)val3).GetComponent<RectTransform>(); } } if ((Object)(object)VisualRect != (Object)null) { if ((Object)(object)BackgroundImage == (Object)null) { BackgroundImage = ((Component)VisualRect).GetComponent<Image>(); } fader = ((Component)VisualRect).GetComponent<ColorFaderRuntime>(); } } public void Init(RecipeRowRuntime owner, CraftPlanner.RecipeChain chain) { OwnerRow = owner; Chain = chain; isSelected = false; isHovered = false; UpdateVisuals(instant: true); } private void OnDestroy() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if ((Object)(object)pathButton != (Object)null) { ((UnityEvent)pathButton.onClick).RemoveListener(new UnityAction(OnClicked)); } if ((Object)(object)buttonEvent != (Object)null) { buttonEvent.triggers.Clear(); } if ((Object)(object)_currentHoveredPath == (Object)(object)this) { _currentHoveredPath = null; } if ((Object)(object)_selectedPathUI == (Object)(object)this) { _selectedPathUI = null; } OwnerRow = null; Chain = null; } private void OnClicked() { OnPathSelected(this); } private void OnHighlightChanged(bool isHighlighted) { if (isHighlighted) { isHovered = true; if ((Object)(object)_currentHoveredPath == (Object)(object)this) { _currentHoveredPath = null; } AttachReticleTo(VisualRect); } else { isHovered = false; if (IsReticleAttachedTo((Transform)(object)VisualRect)) { RestoreReticleToSelection(); } } UpdateVisuals(instant: false); } public void SetSelected(bool selected) { if (isSelected != selected) { isSelected = selected; if (isSelected) { AttachReticleTo(VisualRect); } UpdateVisuals(instant: false); } } private void UpdateVisuals(bool instant) { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) if (!((Object)(object)BackgroundImage == (Object)null)) { Color val = (isSelected ? Col_BG_Active : ((!isHovered) ? Col_BG_Normal : Col_BG_Hover)); if (instant) { ((Graphic)BackgroundImage).color = val; } else { fader.CrossFadeColor(val, 0.1f); } } } } private class NestedScrollRect : ScrollRect { public ScrollRect ParentScroll; public override void OnScroll(PointerEventData data) { //IL_000f: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!((UIBehaviour)this).IsActive()) { return; } Rect rect = ((ScrollRect)this).content.rect; float height = ((Rect)(ref rect)).height; rect = ((ScrollRect)this).viewport.rect; if (!(height > ((Rect)(ref rect)).height)) { if (Object.op_Implicit((Object)(object)ParentScroll)) { ParentScroll.OnScroll(data); } return; } float y = data.scrollDelta.y; float verticalNormalizedPosition = ((ScrollRect)this).verticalNormalizedPosition; if (Object.op_Implicit((Object)(object)ParentScroll) && ((y > 0f && verticalNormalizedPosition >= 0.999f) || (y < 0f && verticalNormalizedPosition <= 0.001f))) { ParentScroll.OnScroll(data); } else { ((ScrollRect)this).OnScroll(data); } } } private sealed class CraftUIRunner : MonoBehaviour { } private class RecipeDropdownRuntime : MonoBehaviour { public ScrollRect ScrollRect; public RectTransform Content; public RectTransform Background; public RecipeRowRuntime CurrentOwner; public int SelectedPathIndex = -1; public void OpenFor(RecipeRowRuntime owner) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0047: 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) CurrentOwner = owner; ((Component)this).gameObject.SetActive(true); ((Component)this).transform.SetParent((Transform)(object)owner.DropdownMountPoint, false); RectTransform val = (RectTransform)((Component)this).transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; if ((Object)(object)ScrollRect != (Object)null) { ((Behaviour)ScrollRect).enabled = owner.Entry.Chains.Count > 4; ScrollRect.verticalNormalizedPosition = 1f; } PopulateDropdown(Content, owner); } public void Close() { if (_activeDropdownRoutine != null && (Object)(object)_runner != (Object)null) { ((MonoBehaviour)_runner).StopCoroutine(_activeDropdownRoutine); _activeDropdownRoutine = null; } if (!((Object)(object)CurrentOwner == (Object)null)) { SelectedPathIndex = -1; ((Component)this).transform.SetParent(_cookbookRoot.transform, false); ((Component)this).gameObject.SetActive(false); CurrentOwner = null; } } private void OnDestroy() { CurrentOwner = null; } } internal sealed class ColorFaderRuntime : MonoBehaviour { [CompilerGenerated] private sealed class <FadeRoutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ColorFaderRuntime <>4__this; public bool ignoreTimeScale; public float duration; public Color target; private Color <start>5__2; private float <timer>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeRoutine>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) int num = <>1__state; ColorFaderRuntime colorFaderRuntime = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <start>5__2 = colorFaderRuntime._targetGraphic.color; <timer>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<timer>5__3 < duration) { <timer>5__3 += (ignoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime); float num2 = Mathf.Clamp01(<timer>5__3 / duration); colorFaderRuntime._targetGraphic.color = Color.Lerp(<start>5__2, target, num2); <>2__current = null; <>1__state = 1; return true; } colorFaderRuntime._targetGraphic.color = target; colorFaderRuntime._activeRoutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Graphic _targetGraphic; private Coroutine _activeRoutine; private void Awake() { _targetGraphic = ((Component)this).GetComponent<Graphic>(); } public void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale = true) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_targetGraphic == (Object)null) { return; } if (_activeRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_activeRoutine); } if (!(_targetGraphic.color == targetColor)) { if (duration <= 0f || !((Component)this).gameObject.activeInHierarchy) { _targetGraphic.color = targetColor; } else { _activeRoutine = ((MonoBehaviour)this).StartCoroutine(FadeRoutine(targetColor, duration, ignoreTimeScale)); } } } [IteratorStateMachine(typeof(<FadeRoutine>d__4))] private IEnumerator FadeRoutine(Color target, float duration, bool ignoreTimeScale) { //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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeRoutine>d__4(0) { <>4__this = this, target = target, duration = duration, ignoreTimeScale = ignoreTimeScale }; } private void OnDisable() { if (_activeRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_activeRoutine); } _activeRoutine = null; } } private struct RecipeRowUI { public CraftPlanner.CraftableEntry Entry; public GameObject RowGO; } [CompilerGenerated] private static class <>O { public static Action<IReadOnlyList<CraftPlanner.CraftableEntry>> <0>__CraftablesForUIChanged; public static UnityAction<string> <1>__OnSearchTextChanged; public static UnityAction <2>__OnGlobalCraftButtonClicked; } [CompilerGenerated] private sealed class <PopulateDropdownRoutine>d__102 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RectTransform contentRoot; public RecipeRowRuntime owner; private int <builtCount>5__2; private List<CraftPlanner.RecipeChain>.Enumerator <>7__wrap2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PopulateDropdownRoutine>d__102(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } <>7__wrap2 = default(List<CraftPlanner.RecipeChain>.Enumerator); <>1__state = -2; } private bool MoveNext() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; foreach (Transform item in (Transform)contentRoot) { Object.Destroy((Object)(object)((Component)item).gameObject); } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if (owner.Entry == null || owner.Entry.Chains == null) { _activeDropdownRoutine = null; return false; } <builtCount>5__2 = 0; <>7__wrap2 = owner.Entry.Chains.GetEnumerator(); <>1__state = -3; break; case 2: <>1__state = -3; break; } while (<>7__wrap2.MoveNext()) { CraftPlanner.RecipeChain current = <>7__wrap2.Current; CreatePathRow(contentRoot, current, owner); <builtCount>5__2++; if (<builtCount>5__2 % 4 == 0) { <>2__current = null; <>1__state = 2; return true; } } <>m__Finally1(); <>7__wrap2 = default(List<CraftPlanner.RecipeChain>.Enumerator); _cachedDropdownOwner = owner; _activeDropdownRoutine = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PopulateRoutine>d__100 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IReadOnlyList<CraftPlanner.CraftableEntry> craftables; public Stopwatch sw; private VerticalLayoutGroup <vlg>5__2; private CanvasGroup <canvasGroup>5__3; private ScrollRect <scrollRect>5__4; private float <previousScrollPos>5__5; private CraftPlanner.CraftableEntry <previousEntry>5__6; private CraftPlanner.RecipeChain <chainToRestoreHover>5__7; private int <builtCount>5__8; private RecipeRowRuntime <rowToRestore>5__9; private IEnumerator<CraftPlanner.CraftableEntry> <>7__wrap9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PopulateRoutine>d__100(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } <vlg>5__2 = null; <canvasGroup>5__3 = null; <scrollRect>5__4 = null; <previousEntry>5__6 = null; <chainToRestoreHover>5__7 = null; <rowToRestore>5__9 = null; <>7__wrap9 = null; <>1__state = -2; } private bool MoveNext() { //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_01c4: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <vlg>5__2 = ((Component)_recipeListContent).GetComponent<VerticalLayoutGroup>(); <canvasGroup>5__3 = ((Component)_recipeListContent).GetComponent<CanvasGroup>(); <scrollRect>5__4 = ((Component)_recipeListContent).GetComponentInParent<ScrollRect>(); if (Object.op_Implicit((Object)(object)<canvasGroup>5__3)) { <canvasGroup>5__3.alpha = 0f; <canvasGroup>5__3.blocksRaycasts = false; } if (Object.op_Implicit((Object)(object)<vlg>5__2)) { ((Behaviour)<vlg>5__2).enabled = false; } bool flag = ((Transform)_recipeListContent).childCount > 0; <previousScrollPos>5__5 = (((Object)(object)<scrollRect>5__4 != (Object)null && flag) ? <scrollRect>5__4.verticalNormalizedPosition : 1f); if ((Object)(object)_selectionReticle != (Object)null) { ((Transform)_selectionReticle).SetParent(_cookbookRoot.transform, false); ((Component)_selectionReticle).gameObject.SetActive(false); } if ((Object)(object)_sharedDropdown != (Object)null) { ((Component)_sharedDropdown).transform.SetParent(_cookbookRoot.transform, false); ((Component)_sharedDropdown).gameObject.SetActive(false); _cachedDropdownOwner = null; _sharedDropdown.CurrentOwner = null; } <previousEntry>5__6 = null; <chainToRestoreHover>5__7 = null; if ((Object)(object)_openRow != (Object)null) { <previousEntry>5__6 = _openRow.Entry; CollapseRow(_openRow); } if ((Object)(object)_currentHoveredPath != (Object)null) { <chainToRestoreHover>5__7 = _currentHoveredPath.Chain; } _openRow = null; _selectedAnchor = null; _currentHoveredPath = null; foreach (Transform item in (Transform)_recipeListContent) { Object.Destroy((Object)(object)((Component)item).gameObject); } _recipeRowUIs.Clear(); <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; if (craftables == null || craftables.Count == 0) { if (Object.op_Implicit((Object)(object)<vlg>5__2)) { ((Behaviour)<vlg>5__2).enabled = true; } if (Object.op_Implicit((Object)(object)<canvasGroup>5__3)) { <canvasGroup>5__3.alpha = 1f; <canvasGroup>5__3.blocksRaycasts = true; } _activeBuildRoutine = null; sw.Stop(); _log.LogInfo((object)$"CraftUI: PopulateRecipeList (Empty) completed in {sw.ElapsedMilliseconds}ms"); return false; } <builtCount>5__8 = 0; <rowToRestore>5__9 = null; <>7__wrap9 = craftables.GetEnumerator(); <>1__state = -3; goto IL_037f; case 2: <>1__state = -3; goto IL_037f; case 3: { <>1__state = -1; break; } IL_037f: while (<>7__wrap9.MoveNext()) { CraftPlanner.CraftableEntry current = <>7__wrap9.Current; if (current != null) { GameObject val = CreateRecipeRow(_recipeListContent, current); RecipeRowRuntime component = val.GetComponent<RecipeRowRuntime>(); _recipeRowUIs.Add(new RecipeRowUI { Entry = current, RowGO = val }); if (<previousEntry>5__6 != null && AreEntriesSame(<previousEntry>5__6, current)) { <rowToRestore>5__9 = component; } <builtCount>5__8++; if (<builtCount>5__8 % 5 == 0) { <>2__current = null; <>1__state = 2; return true; } } } <>m__Finally1(); <>7__wrap9 = null; if (Object.op_Implicit((Object)(object)<vlg>5__2)) { ((Behaviour)<vlg>5__2).enabled = true; LayoutRebuilder.ForceRebuildLayoutImmediate(_recipeListContent); PixelSnap(_recipeListContent); } break; } if (_activeDropdownRoutine != null) { <>2__current = null; <>1__state = 3; return true; } if ((Object)(object)<rowToRestore>5__9 != (Object)null) { ToggleRecipeRow(<rowToRestore>5__9); if ((Object)(object)_sharedDropdown != (Object)null && (Object)(object)_sharedDropdown.CurrentOwner == (Object)(object)<rowToRestore>5__9) { bool flag2 = _selectedChainData != null; bool flag3 = <chainToRestoreHover>5__7 != null; foreach (Transform item2 in (Transform)_sharedDropdown.Content) { Transform val2 = item2; if (!flag2 && !flag3) { break; } PathRowRuntime component2 = ((Component)val2).GetComponent<PathRowRuntime>(); if (!((Object)(object)component2 == (Object)null)) { if (flag2 && component2.Chain == _selectedChainData) { OnPathSelected(component2); flag2 = false; } if (flag3 && component2.Chain == <chainToRestoreHover>5__7) { _currentHoveredPath = component2; AttachReticleTo(component2.VisualRect); flag3 = false; } } } } } else { DeselectCurrentPath(); } if ((Object)(object)<scrollRect>5__4 != (Object)null) { <scrollRect>5__4.verticalNormalizedPosition = <previousScrollPos>5__5; } if (Object.op_Implicit((Object)(object)<canvasGroup>5__3)) { <canvasGroup>5__3.alpha = 1f; <canvasGroup>5__3.blocksRaycasts = true; } _activeBuildRoutine = null; sw.Stop(); _log.LogInfo((object)$"CraftUI: PopulateRecipeList (Empty) completed in {sw.ElapsedMilliseconds}ms"); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap9 != null) { <>7__wrap9.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static ManualLogSource _log; private static IReadOnlyList<CraftPlanner.CraftableEntry> _lastCraftables; private static readonly List<RecipeRowUI> _recipeRowUIs = new List<RecipeRowUI>(); private static bool _skeletonBuilt = false; private static CraftingController _currentController; private static GameObject _cookbookRoot; private static RectTransform _recipeListContent; private static TMP_InputField _searchInputField; private static GameObject _recipeRowTemplate; private static GameObject _pathRowTemplate; private static GameObject _ingredientSlotTemplate; private static GameObject _ResultSlotTemplate; private static RecipeRowRuntime _openRow; private static CraftUIRunner _runner; private static Coroutine _activeBuildRoutine; private static Coroutine _activeDropdownRoutine; private static RecipeDropdownRuntime _sharedDropdown; private static RecipeRowRuntime _cachedDropdownOwner; private static RectTransform _selectionReticle; private static RectTransform _currentReticleTarget; private static RectTransform _selectedAnchor; private static PathRowRuntime _currentHoveredPath; private static Button _globalCraftButton; private static TextMeshProUGUI _globalCraftButtonText; private static Image _globalCraftButtonImage; private static PathRowRuntime _selectedPathUI; private static CraftPlanner.RecipeChain _selectedChainData; private static Sprite _solidPointSprite; private static Sprite _taperedGradientSprite; private static float _panelWidth; private static float _panelHeight; internal const float CookBookPanelPaddingTopNorm = 0.015974442f; internal const float CookBookPanelPaddingBottomNorm = 0.015974442f; internal const float CookBookPanelPaddingLeftNorm = 0f; internal const float CookBookPanelPaddingRightNorm = 0f; internal const float CookBookPanelElementSpacingNorm = 0.015974442f; internal const float SearchBarHeightNorm = 0.079872206f; internal const float SearchBarBottomBorderThicknessNorm = 0.0001f; internal const float RecipeListVerticalPaddingNorm = 0f; internal const float RecipeListLeftPaddingNorm = 1f / 55f; internal const float RecipeListRightPaddingNorm = 1f / 55f; internal const float RecipeListElementSpacingNorm = 0f; internal const float RecipeListScrollbarWidthNorm = 0f; internal const float RowTopHeightNorm = 0.111821085f; internal const float RowTopTopPaddingNorm = 0.007987221f; internal const float RowTopBottomPaddingNorm = 0.007987221f; internal const float RowTopElementSpacingNorm = 1f / 55f; internal const float MetaDataColumnWidthNorm = 14f / 55f; internal const float MetaDataElementSpacingNorm = 0.015974442f; internal const float DropDownArrowSizeNorm = 0.05111821f; internal const float textSizeNorm = 0.038338657f; private const float PathsContainerLeftPaddingNorm = 1f / 55f; private const float PathsContainerRightPaddingNorm = 1f / 55f; private const int PathsContainerMaxVisibleRows = 4; private const float PathsContainerSpacingNorm = 0.007987221f; private const float PathRowHeightNorm = 0.079872206f; private const float PathRowLeftPaddingNorm = 1f / 110f; private const float PathRowRightPaddingNorm = 1f / 110f; private const float PathRowIngredientSpacingNorm = 1f / 110f; private const float IngredientHeightNorm = 0.06709265f; private const float _IngredientStackSizeTextHeightPx = 10f; private const float _IngredientStackMargin = 2f; private const float _ResultStackMargin = 3f; private const float FooterHeightNorm = 0.05f; internal static void Init(ManualLogSource log) { _log = log; StateController.OnCraftablesForUIChanged += CraftablesForUIChanged; } internal static void Attach(CraftingController controller) { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) _currentController = controller; if ((Object)(object)_cookbookRoot != (Object)null) { return; } CraftingPanel val = Object.FindObjectOfType<CraftingPanel>(); if (!Object.op_Implicit((Object)(object)val)) { return; } Transform val2 = ((Component)val).transform.Find("MainPanel/Juice/BGContainer"); RectTransform component = ((Component)val2).GetComponent<RectTransform>(); object obj; if (!Object.op_Implicit((Object)(object)val2)) { obj = null; } else { Transform obj2 = val2.Find("BGMain"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent<RectTransform>() : null); } RectTransform val3 = (RectTransform)obj; Transform obj3 = ((Component)val).transform.Find("MainPanel/Juice/LabelContainer"); RectTransform val4 = ((obj3 != null) ? ((Component)obj3).GetComponent<RectTransform>() : null); Transform obj4 = val2.Find("CraftingContainer/Background"); RectTransform val5 = ((obj4 != null) ? ((Component)obj4).GetComponent<RectTransform>() : null); Transform obj5 = val2.Find("CraftingContainer"); if (obj5 != null) { ((Component)obj5).GetComponent<RectTransform>(); } Transform obj6 = val2.Find("SubmenuContainer"); RectTransform val6 = ((obj6 != null) ? ((Component)obj6).GetComponent<RectTransform>() : null); Transform obj7 = val2.Find("InventoryContainer"); RectTransform val7 = ((obj7 != null) ? ((Component)obj7).GetComponent<RectTransform>() : null); if (!Object.op_Implicit((Object)(object)val4)) { return; } ((Transform)val4).SetParent((Transform)(object)val3, true); float value; Rect rect; if (!Object.op_Implicit((Object)(object)val7)) { value = 0f; } else { rect = val7.rect; value = ((Rect)(ref rect)).width; } float num = RoundToEven(value); float value2; if (!Object.op_Implicit((Object)(object)val7)) { value2 = 0f; } else { rect = val7.rect; value2 = ((Rect)(ref rect)).height; } float num2 = RoundToEven(value2); float value3; if (!Object.op_Implicit((Object)(object)val5)) { value3 = 0f; } else { rect = val5.rect; value3 = ((Rect)(ref rect)).width; } RoundToEven(value3); rect = val3.rect; float num3 = RoundToEven(((Rect)(ref rect)).width); rect = val3.rect; RoundToEven(((Rect)(ref rect)).height); rect = val4.rect; float num4 = RoundToEven(((Rect)(ref rect)).width); Image component2 = ((Component)val3).GetComponent<Image>(); Sprite val8 = (Object.op_Implicit((Object)(object)component2) ? component2.sprite : null); float num5 = RoundToEven(Object.op_Implicit((Object)(object)val8) ? val8.pixelsPerUnit : 1f); float num6 = RoundToEven(Object.op_Implicit((Object)(object)val8) ? (val8.border.x / num5) : 0f); float num7 = RoundToEven(Object.op_Implicit((Object)(object)val8) ? (val8.border.z / num5) : 0f); RoundToEven(Object.op_Implicit((Object)(object)val8) ? (val8.border.w / num5) : 0f); RoundToEven(Object.op_Implicit((Object)(object)val8) ? (val8.border.y / num5) : 0f); float num8 = num6 + num7; float num9 = 1.8f; float num10 = RoundToEven(num3 * num9); float num11 = RoundToEven((num3 - num8 - num4) * 0.5f); float num12 = num10 - num8; float num13 = num12 - 2f * num11; float num14 = RoundToEven(num * 0.88f); float num15 = RoundToEven(num2 * 0.9f); float num16 = num14; float num17 = RoundToEven(Mathf.Clamp(num10 * 0.3f, 260f, num12 - num)); float num18 = RoundToEven(Mathf.Clamp(num10 * 0.05f, 20f, num11)); component.SetSizeWithCurrentAnchors((Axis)0, num10); val4.SetSizeWithCurrentAnchors((Axis)0, num13); val7.SetSizeWithCurrentAnchors((Axis)0, num14); val7.SetSizeWithCurrentAnchors((Axis)1, num15); val5.SetSizeWithCurrentAnchors((Axis)0, num16); AlignLabelVerticallyBetween(val4, val3, val5); rect = val5.rect; float num19 = RoundToEven(((Rect)(ref rect)).width); float num20 = RoundToEven((num12 - (num19 + num18 + num17)) * 0.5f); float x = RoundToEven((0f - num12) * 0.5f + num20 + num19 * 0.5f); Vector2 anchoredPosition = val5.anchoredPosition; anchoredPosition.x = x; val5.anchoredPosition = anchoredPosition; anchoredPosition = val7.anchoredPosition; anchoredPosition.x = x; val7.anchoredPosition = anchoredPosition; anchoredPosition = val6.anchoredPosition; anchoredPosition.x = x; val6.anchoredPosition = anchoredPosition; Bounds val9 = default(Bounds); bool flag = false; if (Object.op_Implicit((Object)(object)val5)) { val9 = RectTransformUtility.CalculateRelativeRectTransformBounds(val2, (Transform)(object)val5); flag = true; } if (Object.op_Implicit((Object)(object)val7)) { Bounds val10 = RectTransformUtility.CalculateRelativeRectTransformBounds(val2, (Transform)(object)val7); if (flag) { ((Bounds)(ref val9)).Encapsulate(val10); } else { val9 = val10; flag = true; } } float num21 = RoundToEven(((Bounds)(ref val9)).size.y); float num22 = RoundToEven(((Bounds)(ref val9)).center.y); _cookbookRoot = CreateUIObject("CookBookPanel", typeof(RectTransform), typeof(CraftUIRunner), typeof(Canvas), typeof(GraphicRaycaster)); _runner = _cookbookRoot.GetComponent<CraftUIRunner>(); _cookbookRoot.GetComponent<Canvas>().pixelPerfect = true; _cookbookRoot.GetComponent<GraphicRaycaster>(); RectTransform component3 = _cookbookRoot.GetComponent<RectTransform>(); _cookbookRoot.transform.SetParent(val2, false); component3.anchorMin = new Vector2(1f, 0.5f); component3.anchorMax = new Vector2(1f, 0.5f); component3.pivot = new Vector2(1f, 0.5f); component3.sizeDelta = new Vector2(num17, num21); component3.anchoredPosition = new Vector2(0f - num20, num22); ((Behaviour)((Component)val4).GetComponent<Image>()).enabled = false; AddBorder(val4, new Color32((byte)209, (byte)209, (byte)210, byte.MaxValue), 2f, 2f, 6f, 6f); _log.LogDebug((object)$"CraftUI.Attach: CookBook panel attached. baseWidth={num3:F1}, newWidth={num10:F1}, cookbookWidth={num17:F1}, invBaseWidth={num:F1}"); rect = component3.rect; _panelWidth = ((Rect)(ref rect)).width; rect = component3.rect; _panelHeight = ((Rect)(ref rect)).height; Stopwatch stopwatch = Stopwatch.StartNew(); CookBookSkeleton(component3); EnsureResultSlotArtTemplates(val); EnsureIngredientSlotTemplate(); BuildRecipeRowTemplate(); BuildPathRowTemplate(); BuildSharedDropdown(); BuildSharedHoverRect(); stopwatch.Stop(); _log.LogInfo((object)$"CraftUI: Skeleton & Templates built in {stopwatch.ElapsedMilliseconds}ms"); if (_lastCraftables != null && _lastCraftables.Count > 0) { PopulateRecipeList(_lastCraftables); } } internal static void Detach() { if ((Object)(object)_cookbookRoot != (Object)null) { Object.Destroy((Object)(object)_cookbookRoot); _cookbookRoot = null; _log.LogInfo((object)"CraftUI.Detach: CookBook panel destroyed."); } if ((Object)(object)_globalCraftButton != (Object)null) { ((UnityEventBase)_globalCraftButton.onClick).RemoveAllListeners(); } _currentController = null; _skeletonBuilt = false; _recipeListContent = null; } internal static void CloseCraftPanel(CraftingController specificController = null) { CraftingController val = (Object.op_Implicit((Object)(object)specificController) ? specificController : _currentController); if (!Object.op_Implicit((Object)(object)val)) { return; } CraftingPanel[] array = Object.FindObjectsOfType<CraftingPanel>(); foreach (CraftingPanel val2 in array) { if ((Object)(object)val2.craftingController == (Object)(object)val) { Object.Destroy((Object)(object)((Component)val2).gameObject); break; } } } internal static void Shutdown() { StateController.OnCraftablesForUIChanged -= CraftablesForUIChanged; ((UnityEventBase)_searchInputField.onValueChanged).RemoveAllListeners(); } internal static void CookBookSkeleton(RectTransform cookbookRoot) { //IL_003c: 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_0069: Expected O, but got Unknown //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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_026b: 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_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Unknown result type (might be due to invalid IL or missing references) //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_09db: Unknown result type (might be due to invalid IL or missing references) //IL_09e5: Expected O, but got Unknown //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)cookbookRoot)) { for (int num = ((Transform)cookbookRoot).childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)((Transform)cookbookRoot).GetChild(num)).gameObject); } AddBorderTapered((RectTransform)_cookbookRoot.transform, new Color32((byte)209, (byte)209, (byte)210, byte.MaxValue), 2f, 2f); float num2 = RoundToEven(0.015974442f * _panelHeight); float num3 = RoundToEven(0.015974442f * _panelHeight); float num4 = RoundToEven(0f * _panelWidth); float num5 = RoundToEven(0f * _panelWidth); float num6 = RoundToEven(0.015974442f * _panelHeight); float num7 = RoundToEven(0.079872206f * _panelHeight); float num8 = RoundToEven(0.05f * _panelHeight); float num9 = _panelHeight - num2 - num3 - num7 - num8 - num6 * 2f; int num10 = Mathf.RoundToInt(0f * _panelHeight); if (num9 < 0f) { num9 = 0f; } RectTransform component = CreateUIObject("SearchBarContainer", typeof(RectTransform)).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)cookbookRoot, false); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(0f, num7); component.anchoredPosition = new Vector2(0f, 0f - num2); Vector2 offsetMin = component.offsetMin; Vector2 offsetMax = component.offsetMax; offsetMin.x = num4; offsetMax.x = 0f - num5; component.offsetMin = offsetMin; component.offsetMax = offsetMax; GameObject obj = CreateUIObject("SearchInput", typeof(RectTransform), typeof(Image), typeof(TMP_InputField)); RectTransform component2 = obj.GetComponent<RectTransform>(); Image component3 = obj.GetComponent<Image>(); _searchInputField = obj.GetComponent<TMP_InputField>(); ((Transform)component2).SetParent((Transform)(object)component, false); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.sizeDelta = Vector2.zero; component2.anchoredPosition = Vector2.zero; ((Graphic)component3).color = new Color(0f, 0f, 0f, 0.4f); ((Graphic)component3).raycastTarget = false; RectTransform component4 = CreateUIObject("Text Area", typeof(RectTransform), typeof(RectMask2D)).GetComponent<RectTransform>(); ((Transform)component4).SetParent((Transform)(object)component2, false); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = Vector2.zero; component4.offsetMax = Vector2.zero; GameObject obj2 = CreateUIObject("Text", typeof(RectTransform), typeof(TextMeshProUGUI)); TextMeshProUGUI component5 = obj2.GetComponent<TextMeshProUGUI>(); RectTransform component6 = obj2.GetComponent<RectTransform>(); ((Transform)component6).SetParent((Transform)(object)component4, false); component6.anchorMin = Vector2.zero; component6.anchorMax = Vector2.one; component6.sizeDelta = Vector2.zero; ((TMP_Text)component5).fontSize = 20f; ((TMP_Text)component5).alignment = (TextAlignmentOptions)514; ((Graphic)component5).color = Color.white; GameObject obj3 = CreateUIObject("Placeholder", typeof(RectTransform), typeof(TextMeshProUGUI)); RectTransform component7 = obj3.GetComponent<RectTransform>(); TextMeshProUGUI component8 = obj3.GetComponent<TextMeshProUGUI>(); ((Transform)component7).SetParent((Transform)(object)component4, false); component7.anchorMin = Vector2.zero; component7.anchorMax = Vector2.one; component7.sizeDelta = Vector2.zero; ((TMP_Text)component8).text = "search"; ((TMP_Text)component8).fontSize = 20f; ((TMP_Text)component8).alignment = (TextAlignmentOptions)514; ((Graphic)component8).color = new Color(1f, 1f, 1f, 0.5f); ((Graphic)component8).raycastTarget = false; _searchInputField.textViewport = component4; _searchInputField.textComponent = (TMP_Text)(object)component5; _searchInputField.placeholder = (Graphic)(object)component8; ((UnityEvent<string>)(object)_searchInputField.onValueChanged).AddListener((UnityAction<string>)OnSearchTextChanged); AddBorderTapered(component2, new Color32((byte)209, (byte)209, (byte)210, (byte)200), 0f, Mathf.Max(1f, 0.0001f * _panelHeight)); RectTransform component9 = CreateUIObject("Footer", typeof(RectTransform)).GetComponent<RectTransform>(); ((Transform)component9).SetParent((Transform)(object)cookbookRoot, false); component9.anchorMin = new Vector2(0f, 0f); component9.anchorMax = new Vector2(1f, 0f); component9.pivot = new Vector2(0.5f, 0f); component9.sizeDelta = new Vector2(0f, num8); component9.anchoredPosition = new Vector2(0f, num3); component9.offsetMin = new Vector2(num4, component9.offsetMin.y); component9.offsetMax = new Vector2(0f - num5, component9.offsetMax.y); GameObject obj4 = CreateUIObject("GlobalCraftButton", typeof(RectTransform), typeof(Image), typeof(Button)); RectTransform component10 = obj4.GetComponent<RectTransform>(); Image component11 = obj4.GetComponent<Image>(); Button component12 = obj4.GetComponent<Button>(); ((Transform)component10).SetParent((Transform)(object)component9, false); component10.anchorMin = Vector2.zero; component10.anchorMax = Vector2.one; component10.sizeDelta = Vector2.zero; ((Graphic)component11).color = Color32.op_Implicit(new Color32((byte)40, (byte)40, (byte)40, byte.MaxValue)); ((Graphic)component11).raycastTarget = false; ((Selectable)component12).interactable = false; GameObject obj5 = CreateUIObject("Text", typeof(RectTransform), typeof(TextMeshProUGUI)); RectTransform component13 = obj5.GetComponent<RectTransform>(); TextMeshProUGUI component14 = obj5.GetComponent<TextMeshProUGUI>(); ((Transform)component13).SetParent((Transform)(object)component10, false); component13.anchorMin = Vector2.zero; component13.anchorMax = Vector2.one; ((TMP_Text)component14).text = "select a recipe"; ((TMP_Text)component14).alignment = (TextAlignmentOptions)514; ((TMP_Text)component14).fontSize = num8 * 0.5f; ((Graphic)component14).color = Color32.op_Implicit(new Color32((byte)100, (byte)100, (byte)100, byte.MaxValue)); _globalCraftButton = component12; _globalCraftButtonText = component14; _globalCraftButtonImage = component11; AddBorder(component9, new Color32((byte)209, (byte)209, (byte)210, (byte)200), 1f, 1f, 1f, 1f); ButtonClickedEvent onClick = _globalCraftButton.onClick; object obj6 = <>O.<2>__OnGlobalCraftButtonClicked; if (obj6 == null) { UnityAction val = OnGlobalCraftButtonClicked; <>O.<2>__OnGlobalCraftButtonClicked = val; obj6 = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj6); GameObject obj7 = CreateUIObject("RecipeListContainer", typeof(RectTransform), typeof(ScrollRect)); RectTransform component15 = obj7.GetComponent<RectTransform>(); ScrollRect component16 = obj7.GetComponent<ScrollRect>(); ((Transform)component15).SetParent((Transform)(object)cookbookRoot, false); component15.anchorMin = new Vector2(0f, 1f); component15.anchorMax = Vector2.one; component15.pivot = new Vector2(0.5f, 1f); component15.sizeDelta = new Vector2(0f, num9); float num11 = num2 + num7 + num6; component15.anchoredPosition = new Vector2(0f, 0f - num11); component15.offsetMin = new Vector2(num4, component15.offsetMin.y); component15.offsetMax = new Vector2(0f - num5, component15.offsetMax.y); component16.horizontal = false; component16.vertical = true; component16.scrollSensitivity = 0.111821085f * _panelHeight * 0.5f; component16.movementType = (MovementType)2; component16.inertia = true; component16.decelerationRate = 0.16f; component16.elasticity = 0.1f; GameObject obj8 = CreateUIObject("Viewport", typeof(RectTransform), typeof(RectMask2D), typeof(Image)); RectTransform component17 = obj8.GetComponent<RectTransform>(); Image component18 = obj8.GetComponent<Image>(); ((Transform)component17).SetParent((Transform)(object)component15, false); component17.anchorMin = Vector2.zero; component17.anchorMax = Vector2.one; component17.sizeDelta = Vector2.zero; component16.viewport = component17; ((Graphic)component18).color = Color.clear; ((Graphic)component18).raycastTarget = false; GameObject obj9 = CreateUIObject("Content", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter), typeof(CanvasGroup)); RectTransform component19 = obj9.GetComponent<RectTransform>(); ((Transform)component19).SetParent((Transform)(object)component17, false); component19.anchorMin = new Vector2(0f, 1f); component19.anchorMax = Vector2.one; component19.pivot = new Vector2(0.5f, 1f); component19.anchoredPosition = Vector2.zero; component19.sizeDelta = Vector2.zero; component16.content = component19; _recipeListContent = component19; VerticalLayoutGroup component20 = obj9.GetComponent<VerticalLayoutGroup>(); ((LayoutGroup)component20).padding = new RectOffset(Mathf.RoundToInt(1f / 55f * _panelWidth), Mathf.RoundToInt(1f / 55f * _panelWidth), num10, num10); ((HorizontalOrVerticalLayoutGroup)component20).spacing = 0f * _panelHeight; ((LayoutGroup)component20).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)component20).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component20).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component20).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)component20).childForceExpandWidth = true; ContentSizeFitter component21 = obj9.GetComponent<ContentSizeFitter>(); component21.verticalFit = (FitMode)2; component21.horizontalFit = (FitMode)0; _skeletonBuilt = true; } } internal static GameObject CreateRecipeRow(RectTransform parent, CraftPlanner.CraftableEntry entry) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown if ((Object)(object)_recipeRowTemplate == (Object)null) { return null; } GameObject val = Object.Instantiate<GameObject>(_recipeRowTemplate, (Transform)(object)parent); ((Object)val).name = "RecipeRow"; val.SetActive(true); RecipeRowRuntime runtime = val.GetComponent<RecipeRowRuntime>(); if ((Object)(object)runtime == (Object)null) { _log.LogError((object)"CreateRecipeRow: RecipeRowRuntime component missing on template."); return val; } runtime.Entry = entry; runtime.IsExpanded = false; if ((Object)(object)runtime.ItemLabel != (Object)null) { ((TMP_Text)runtime.ItemLabel).text = GetEntryDisplayName(entry); ((Graphic)runtime.ItemLabel).color = GetEntryColor(entry); } if ((Object)(object)runtime.DepthText != (Object)null) { ((TMP_Text)runtime.DepthText).text = $" Min Depth: {entry.MinDepth}"; } if ((Object)(object)runtime.PathsText != (Object)null) { ((TMP_Text)runtime.PathsText).text = $"Paths: {entry.Chains.Count}"; } if ((Object)(object)runtime.ResultIcon != (Object)null) { Sprite icon = GetIcon(entry.ResultIndex); if ((Object)(object)icon != (Object)null) { runtime.ResultIcon.sprite = icon; ((Graphic)runtime.ResultIcon).color = Color.white; } else { runtime.ResultIcon.sprite = null; ((Graphic)runtime.ResultIcon).color = new Color(1f, 1f, 1f, 0.1f); } } if ((Object)(object)runtime.ResultStackText != (Object)null) { if (entry.ResultCount > 1) { ((TMP_Text)runtime.ResultStackText).text = entry.ResultCount.ToString(); ((Component)runtime.ResultStackText).gameObject.SetActive(true); } else { ((Component)runtime.ResultStackText).gameObject.SetActive(false); } } if ((Object)(object)runtime.RowTopButton != (Object)null) { ((UnityEventBase)runtime.RowTopButton.onClick).RemoveAllListeners(); ((UnityEvent)runtime.RowTopButton.onClick).AddListener((UnityAction)delegate { ToggleRecipeRow(runtime); }); } if ((Object)(object)runtime.DropdownLayoutElement != (Object)null) { runtime.DropdownLayoutElement.preferredHeight = 0f; } return val; } private static GameObject CreatePathRow(RectTransform parent, CraftPlanner.RecipeChain chain, RecipeRowRuntime owner) { if ((Object)(object)_pathRowTemplate == (Object)null) { return null; } GameObject val = Object.Instantiate<GameObject>(_pathRowTemplate, (Transform)(object)parent); ((Object)val).name = "PathRow"; val.SetActive(true); PathRowRuntime component = val.GetComponent<PathRowRuntime>(); if ((Object)(object)component != (Object)null) { component.Init(owner, chain); } else { _log.LogError((object)"PathRowTemplate missing PathRowRuntime component."); } if (chain.TotalCost != null) { for (int i = 0; i < chain.TotalCost.Length; i++) { int num = chain.TotalCost[i]; if (num > 0) { Sprite icon = GetIcon(i); if ((Object)(object)icon != (Object)null) { CreateIngredientSlot((Transform)(object)component.VisualRect, icon, num); } } } } return val; } private static void CreateIngredientSlot(Transform parentRow, Sprite icon, int count) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_ingredientSlotTemplate == (Object)null) { return; } GameObject obj = Object.Instantiate<GameObject>(_ingredientSlotTemplate, parentRow); ((Object)obj).name = "IngredientSlot"; obj.SetActive(true); Transform obj2 = obj.transform.Find("Background/Icon"); Image val = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null); if ((Object)(object)val != (Object)null) { val.sprite = icon; ((Graphic)val).raycastTarget = false; ((Graphic)val).color = Color.white; } Transform obj3 = obj.transform.Find("Background/StackText"); TextMeshProUGUI val2 = ((obj3 != null) ? ((Component)obj3).GetComponent<TextMeshProUGUI>() : null); if ((Object)(object)val2 != (Object)null) { if (count > 1) { ((Component)val2).gameObject.SetActive(true); ((TMP_Text)val2).text = count.ToString(); } else { ((Component)val2).gameObject.SetActive(false); } } } private static void BuildRecipeRowTemplate() { //IL_0128: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_085c: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_0956: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_recipeRowTemplate != (Object)null)) { float num = RoundToEven(0.007987221f * _panelHeight); float num2 = RoundToEven(0.007987221f * _panelHeight); float num3 = RoundToEven(1f / 55f * _panelWidth); float num4 = RoundToEven(0.111821085f * _panelHeight); float num5 = RoundToEven(14f / 55f * _panelWidth); float num6 = RoundToEven(0.015974442f * _panelHeight); float fontSize = RoundToEven(0.05111821f * _panelHeight); float fontSize2 = RoundToEven(0.038338657f * _panelHeight); float num7 = num4 - (num + num2); GameObject val = CreateUIObject("RecipeRowTemplate", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(LayoutElement), typeof(RecipeRowRuntime)); RectTransform component = val.GetComponent<RectTransform>(); VerticalLayoutGroup component2 = val.GetComponent<VerticalLayoutGroup>(); LayoutElement component3 = val.GetComponent<LayoutElement>(); ((Transform)component).SetParent(_cookbookRoot.transform, false); val.SetActive(false); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(0f, num4); ((HorizontalOrVerticalLayoutGroup)component2).spacing = 0f; ((LayoutGroup)component2).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false; component3.minHeight = num4; component3.preferredHeight = num4; component3.flexibleHeight = 0f; component3.flexibleWidth = 1f; GameObject val2 = CreateUIObject("RowTop", typeof(RectTransform), typeof(Image), typeof(Button), typeof(LayoutElement)); RectTransform component4 = val2.GetComponent<RectTransform>(); Image component5 = val2.GetComponent<Image>(); LayoutElement component6 = val2.GetComponent<LayoutElement>(); ((Transform)component4).SetParent((Transform)(object)component, false); component6.minHeight = num4; component6.preferredHeight = num4; component6.flexibleHeight = 0f; component6.flexibleWidth = 1f; ((Graphic)component5).color = new Color(0f, 0f, 0f, 0f); ((Graphic)component5).raycastTarget = true; RectTransform component7 = CreateUIObject("DropDown", typeof(RectTransform)).GetComponent<RectTransform>(); ((Transform)component7).SetParent((Transform)(object)component4, false); component7.anchorMin = new Vector2(0f, 0.5f); component7.anchorMax = new Vector2(0f, 0.5f); component7.pivot = new Vector2(0f, 0.5f); component7.sizeDelta = new Vector2(num7, num7); component7.anchoredPosition = Vector2.zero; GameObject obj = CreateUIObject("Arrow", typeof(RectTransform), typeof(TextMeshProUGUI)); RectTransform component8 = obj.GetComponent<RectTransform>(); TextMeshProUGUI component9 = obj.GetComponent<TextMeshProUGUI>(); ((Transform)component8).SetParent((Transform)(object)component7, false); component8.anchorMin = Vector2.zero; component8.anchorMax = Vector2.one; component8.offsetMin = Vector2.zero; component8.offsetMax = Vector2.zero; ((TMP_Text)component9).text = ">"; ((TMP_Text)component9).alignment = (TextAlignmentOptions)514; ((TMP_Text)component9).fontSize = fontSize; ((Graphic)component9).color = Color.white; ((Graphic)component9).raycastTarget = false; ((TMP_Text)component9).enableWordWrapping = false; ((TMP_Text)component9).overflowMode = (TextOverflowModes)0; GameObject val3 = Object.Instantiate<GameObject>(_ResultSlotTemplate, (Transform)(object)component4, false); ((Object)val3).name = "ItemSlot"; val3.SetActive(true); RectTransform component10 = val3.GetComponent<RectTransform>(); ((Transform)component10).SetParent((Transform)(object)component4, false); float num8 = num7 + num3; component10.anchorMin = new Vector2(0f, 0.5f); component10.anchorMax = new Vector2(0f, 0.5f); component10.pivot = new Vector2(0f, 0.5f); component10.sizeDelta = new Vector2(num7, num7); component10.anchoredPosition = new Vector2(num8, 0f); GameObject obj2 = CreateUIObject("ItemLabel", typeof(RectTransform), typeof(TextMeshProUGUI)); RectTransform component11 = obj2.GetComponent<RectTransform>(); TextMeshProUGUI component12 = obj2.GetComponent<TextMeshProUGUI>(); ((Transform)component11).SetParent((Transform)(object)component4, false); float num9 = num8 + num7 + num3; float num10 = 0f - (num5 + num3); component11.anchorMin = new Vector2(0f, 0.5f); component11.anchorMax = new Vector2(1f, 0.5f); component11.pivot = new Vector2(0.5f, 0.5f); component11.offsetMin = new Vector2(num9, (0f - num7) * 0.5f); component11.offsetMax = new Vector2(num10, num7 * 0.5f); ((TMP_Text)component12).text = "NAME"; ((TMP_Text)component12).fontSize = fontSize2; ((TMP_Text)component12).enableWordWrapping = false; ((TMP_Text)component12).overflowMode = (TextOverflowModes)1; ((TMP_Text)component12).alignment = (TextAlignmentOptions)514; ((Graphic)component12).color = Color.white; ((Graphic)component12).raycastTarget = false; RectTransform component13 = CreateUIObject("MetaData", typeof(RectTransform)).GetComponent<RectTransform>(); ((Transform)component13).SetParent((Transform)(object)component4, false); component13.anchorMin = new Vector2(1f, 0.5f); component13.anchorMax = new Vector2(1f, 0.5f); component13.pivot = new Vector2(1f, 0.5f); component13.sizeDelta = new Vector2(num5, num7); component13.anchoredPosition = Vector2.zero; float num11 = RoundToEven(num6 / 2f); GameObject obj3 = CreateUIObject("MinimumDepth", typeof(RectTransform), typeof(TextMeshProUGUI)); RectTransform component14 = obj3.GetComponent<RectTransform>(); TextMeshProUGUI component15 = obj3.GetComponent<TextMeshProUGUI>(); ((Transform)component14).SetParent((Transform)(object)component13, false); component14.anchorMin = new Vector2(1f, 0.5f); component14.anchorMax = new Vector2(1f, 0.5f); component14.pivot = new Vector2(1f, 0f); component14.anchoredPosition = new Vector2(0f, num11); component14.sizeDelta = new Vector2(num5, 0f); ((TMP_Text)component15).text = "Depth: 0"; ((TMP_Text)component15).fontSize = 16f; ((TMP_Text)component15).alignment = (TextAlignmentOptions)1028; ((Graphic)component15).color = Color.white; ((Graphic)component15).raycastTarget = false; GameObject obj4 = CreateUIObject("AvailablePaths", typeof(RectTransform), typeof(TextMeshProUGUI)); RectTransform component16 = obj4.GetComponent<RectTransform>(); TextMeshProUGUI component17 = obj4.GetComponent<TextMeshProUGUI>(); ((Transform)component16).SetParent((Transform)(object)component13, false); component16.anchorMin = new Vector2(1f, 0.5f); component16.anchorMax = new Vector2(1f, 0.5f); component16.pivot = new Vector2(1f, 1f); component16.anchoredPosition = new Vector2(0f, 0f - num11); component16.sizeDelta = new Vector2(num5, 0f); ((TMP_Text)component17).text = "Paths: 0"; ((TMP_Text)component17).fontSize = 16f; ((TMP_Text)component17).alignment = (TextAlignmentOptions)260; ((Graphic)component17).color = Color.white; ((Graphic)component17).raycastTarget = false; AddBorderTapered(component4, new Color32((byte)209, (byte)209, (byte)210, (byte)200), 1f, 1f); GameObject obj5 = CreateUIObject("DropdownMountPoint", typeof(RectTransform), typeof(LayoutElement)); RectTransform component18 = obj5.GetComponent<RectTransform>(); LayoutElement component19 = obj5.GetComponent<LayoutElement>(); ((Transform)component18).SetParent((Transform)(object)component, false); component18.pivot = new Vector2(0.5f, 1f); component18.anchorMin = new Vector2(0f, 1f); component18.anchorMax = new Vector2(1f, 1f); component18.sizeDelta = Vector2.zero; component19.minHeight = 0f; component19.preferredHeight = 0f; component19.flexibleHeight = 0f; component19.flexibleWidth = 1f; RecipeRowRuntime component20 = val.GetComponent<RecipeRowRuntime>(); component20.Entry = null; component20.RowTransform = component; component20.RowTop = component4; component20.RowLayoutElement = component3; component20.RowTopButton = val2.GetComponent<Button>(); component20.ArrowText = component9; component20.DropdownMountPoint = component18; component20.DropdownLayoutElement = component19; component20.ResultIcon = ((Component)val3.transform.Find("Icon")).GetComponent<Image>(); component20.ResultStackText = ((Component)val3.transform.Find("StackText")).GetComponent<TextMeshProUGUI>(); component20.ItemLabel = component12; component20.DepthText = component15; component20.PathsText = component17; component20.CollapsedHeight = component.sizeDelta.y; component20.IsExpanded = false; _recipeRowTemplate = val; } } private static void BuildPathRowTemplate() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_0135: 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_0161: 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_0179: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_pathRowTemplate != (Object)null)) { float num = RoundToEven(0.079872206f * _panelHeight); float num2 = RoundToEven(0.007987221f * _panelHeight); float spacing = RoundToEven(1f / 110f * _panelWidth); int num3 = Mathf.RoundToInt(1f / 110f * _panelWidth); int num4 = Mathf.RoundToInt(1f / 110f * _panelWidth); float preferredHeight = num + num2; float num5 = RoundToEven(num2 / 2f); GameObject val = CreateUIObject("PathRowTemplate", typeof(RectTransform), typeof(Image), typeof(LayoutElement), typeof(Button), typeof(EventTrigger), typeof(PathRowRuntime)); RectTransform val2 = (RectTransform)val.transform; LayoutElement component = val.GetComponent<LayoutElement>(); Image component2 = val.GetComponent<Image>(); PathRowRuntime component3 = val.GetComponent<PathRowRuntime>(); Button component4 = val.GetComponent<Button>(); EventTrigger component5 = val.GetComponent<EventTrigger>(); ((Transform)val2).SetParent(_cookbookRoot.transform, false); val.SetActive(false); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.anchoredPosition = Vector2.zero; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; component.preferredHeight = preferredHeight; component.flexibleHeight = 0f; component.flexibleWidth = 1f; ((Graphic)component2).color = Color.clear; ((Graphic)component2).raycastTarget = true; ((Selectable)component4).targetGraphic = (Graphic)(object)component2; ((Selectable)component4).transition = (Transition)0; GameObject obj = CreateUIObject("Visuals", typeof(RectTransform), typeof(Image), typeof(HorizontalLayoutGroup), typeof(ColorFaderRuntime)); RectTransform val3 = (RectTransform)obj.transform; Image component6 = obj.GetComponent<Image>(); HorizontalLayoutGroup component7 = obj.GetComponent<HorizontalLayoutGroup>(); ((Transform)val3).SetParent((Transform)(object)val2, false); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = new Vector2(0f, num5); val3.offsetMax = new Vector2(0f, 0f - num5); ((HorizontalOrVerticalLayoutGroup)component7).spacing = spacing; ((LayoutGroup)component7).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)component7).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component7).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component7).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component7).childForceExpandHeight = false; ((LayoutGroup)component7).padding = new RectOffset(num3, num4, 0, 0); ((Graphic)component6).color = Color32.op_Implicit(new Color32((byte)26, (byte)26, (byte)26, (byte)100)); ((Graphic)component6).raycastTarget = false; AddBorderTapered(val3, new Color32((byte)209, (byte)209, (byte)210, (byte)200), 1f, 1f); component3.BackgroundImage = component6; component3.VisualRect = val3; component3.pathButton = component4; component3.buttonEvent = component5; _pathRowTemplate = val; } } private static void BuildSharedDropdown() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Expected O, but got Unknown if (!((Object)(object)_sharedDropdown != (Object)null)) { GameObject val = CreateUIObject("SharedDropdown", typeof(RectTransform), typeof(Image), typeof(NestedScrollRect), typeof(RecipeDropdownRuntime)); RectTransform component = val.GetComponent<RectTransform>(); Image component2 = val.GetComponent<Image>(); _sharedDropdown = val.GetComponent<RecipeDropdownRuntime>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 0.5f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)component2).color = Color.clear; NestedScrollRect component3 = val.GetComponent<NestedScrollRect>(); ((ScrollRect)component3).horizontal = false; ((ScrollRect)component3).vertical = true; ((ScrollRect)component3).scrollSensitivity = 0.111821085f * _panelHeight * 0.5f; ((ScrollRect)component3).movementType = (MovementType)2; ((ScrollRect)component3).inertia = true; ((ScrollRect)component3).decelerationRate = 0.16f; ((ScrollRect)component3).elasticity = 0.1f; if (Object.op_Implicit((Object)(object)_cookbookRoot)) { ScrollRect componentInChildren = _cookbookRoot.GetComponentInChildren<ScrollRect>(); component3.ParentScroll = componentInChildren; } RectTransform component4 = CreateUIObject("Viewport", typeof(RectTransform), typeof(RectMask2D)).GetComponent<RectTransform>(); ((Transform)component4).SetParent((Transform)(object)component, false); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = Vector2.zero; component4.offsetMax = Vector2.zero; component4.sizeDelta = Vector2.zero; ((ScrollRect)component3).viewport = component4; GameObject obj = CreateUIObject("Content", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter)); RectTransform component5 = obj.GetComponent<RectTransform>(); ((Transform)component5).SetParent((Transform)(object)component4, false); component5.anchorMin = new Vector2(0f, 1f); component5.anchorMax = new Vector2(1f, 1f); component5.pivot = new Vector2(0.5f, 1f); component5.offsetMin = Vector2.zero; component5.offsetMax = Vector2.zero; component5.anchoredPosition = Vector2.zero; ((ScrollRect)component3).content = component5; VerticalLayoutGroup component6 = obj.GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component6).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component6).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component6).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)component6).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component6).spacing = 0f; int num = Mathf.RoundToInt(0.007987221f * _panelHeight / 2f); int num2 = Mathf.RoundToInt(1f / 55f * _panelWidth); ((LayoutGroup)component6).padding = new RectOffset(num2, num2, num, num); obj.GetComponent<ContentSizeFitter>().verticalFit = (FitMode)2; _sharedDropdown.ScrollRect = (ScrollRect)(object)component3; _sharedDropdown.Content = component5; _sharedDropdown.Background = component; val.transform.SetParent(_cookbookRoot.transform, false); val.SetActive(false); } } private static void BuildSharedHoverRect() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_selectionReticle != (Object)null)) { GameObject obj = CreateUIObject("SelectionReticle", typeof(RectTransform), typeof(Image), typeof(Canvas), typeof(LayoutElement)); _selectionReticle = obj.GetComponent<RectTransform>(); obj.GetComponent<LayoutElement>().ignoreLayout = true; ((Transform)_selectionReticle).SetParent(_cookbookRoot.transform, false); _selectionReticle.anchorMin = Vector2.zero; _selectionReticle.anchorMax = Vector2.one; _selectionReticle.pivot = new Vector2(0.5f, 0.5f); _selectionReticle.sizeDelta = Vector2.zero; Canvas component = obj.GetComponent<Canvas>(); component.overrideSorting = true; component.sortingOrder = 30; AddBorder(_selectionReticle, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 3f, 3f, 3f, 3f); Image component2 = obj.GetComponent<Image>(); ((Graphic)component2).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)0)); ((Graphic)component2).raycastTarget = false; obj.SetActive(false); } } private static void EnsureResultSlotArtTemplates(CraftingPanel craftingPanel) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) if (!(