Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Quads Recycler v1.3.3
plugins/Recycler.dll
Decompiled 7 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.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DHack.Shared; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI (Claude Code).")] [assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")] [assembly: AssemblyMetadata("ClaudeTools.Reload", "world")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Recycler { internal static class Calc { internal class Entry { public ItemDrop Res; public double Expected; public int Min; public int Max; } internal class Quote { public readonly List<Entry> Entries = new List<Entry>(); public string Blocked; public int Percent; } internal const string KeepTag = "DHack.QuickStack.Keep"; private static readonly Dictionary<string, Recipe> Recipes = new Dictionary<string, Recipe>(); private static readonly Random Dice = new Random(); internal static void ClearCache() { Recipes.Clear(); } internal static int Percent(RecyclerStation station) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) int num = RecyclerPress.CountNear(((Component)station).transform.position); int num2 = ((num >= 2) ? Plugin.Press2Bonus.Value : ((num == 1) ? Plugin.Press1Bonus.Value : 0)); return Mathf.Clamp(Plugin.BasePercent.Value + num2, 0, 100); } private static Recipe RecipeOf(ItemData item) { string name = item.m_shared.m_name; if (!Recipes.TryGetValue(name, out var value)) { value = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetRecipe(item) : null); if ((Object)(object)value != (Object)null && (value.m_resources == null || value.m_resources.Length == 0 || value.m_requireOnlyOneIngredient)) { value = null; } Recipes[name] = value; } return value; } internal static bool Listed(ItemData item) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (item.m_customData != null && item.m_customData.ContainsKey("DHack.QuickStack.Keep")) { return false; } if (!TypeAllowed(item.m_shared.m_itemType)) { return false; } return (Object)(object)RecipeOf(item) != (Object)null; } private static bool TypeAllowed(ItemType t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected I4, but got Unknown switch (t - 3) { case 0: case 1: case 11: case 17: case 19: return Plugin.AllowWeapons.Value; case 2: case 3: case 4: case 8: case 14: return Plugin.AllowArmor.Value; case 12: case 16: return Plugin.AllowTools.Value; default: return false; } } internal static bool Valuable(ItemData item) { if (!item.m_equipped && item.m_quality < 2) { return HasModData(item); } return true; } internal static bool HasModData(ItemData item) { if (item.m_customData != null) { return item.m_customData.Count > 0; } return false; } internal static Quote Evaluate(ItemData item, RecyclerStation station) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) Quote quote = new Quote { Percent = Percent(station) }; Recipe val = RecipeOf(item); if ((Object)(object)val == (Object)null) { quote.Blocked = Translations.T("recycler_cant"); return quote; } if (Plugin.RequireStation.Value && (Object)(object)val.m_craftingStation != (Object)null) { string text = Localization.instance.Localize(val.m_craftingStation.m_name); CraftingStation val2 = CraftingStation.HaveBuildStationInRange(val.m_craftingStation.m_name, ((Component)station).transform.position); if ((Object)(object)val2 == (Object)null) { quote.Blocked = Translations.T("recycler_needs_station", text); return quote; } int requiredStationLevel = val.GetRequiredStationLevel(1); if (val2.GetLevel(true) < requiredStationLevel) { quote.Blocked = Translations.T("recycler_needs_level", text, requiredStationLevel); return quote; } } int num = Mathf.Max(1, item.m_quality); double num2 = (double)item.m_stack / (double)Mathf.Max(1, val.m_amount); int num3 = Mathf.Min(num, Mathf.Max(1, item.m_shared.m_maxQuality)); Requirement[] resources = val.m_resources; foreach (Requirement val3 in resources) { if (!((Object)(object)val3.m_resItem == (Object)null) && !val3.m_upgraderResource) { int num4 = 0; for (int j = 1; j <= num3; j++) { num4 += val3.GetAmount(j); } double num5 = (double)num4 * ((double)quote.Percent / 100.0) * num2; int num6 = (int)Math.Floor(num5); int num7 = ((Plugin.ChanceRounding.Value && num5 - (double)num6 > 0.001) ? (num6 + 1) : num6); if (num7 > 0) { quote.Entries.Add(new Entry { Res = val3.m_resItem, Expected = num5, Min = num6, Max = num7 }); } } } if (quote.Entries.Count == 0) { quote.Blocked = Translations.T("recycler_too_little"); } return quote; } internal static int Roll(Entry e) { if (e.Max == e.Min) { return e.Min; } if (!(Dice.NextDouble() < e.Expected - (double)e.Min)) { return e.Min; } return e.Max; } } internal static class GameUi { internal sealed class Edge { internal Image[] Sides; private Color _color; internal void SetColor(Color color, bool force = false) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) if (force || !(color == _color)) { _color = color; Image[] sides = Sides; foreach (Image val in sides) { ((Graphic)val).color = color; ((Behaviour)val).enabled = color.a > 0.01f; } } } } internal sealed class Meter { internal RectTransform Groove; internal Image Fill; internal Image Trail; internal TMP_Text Text; internal TMP_Text Shadow; private float _fill = -1f; private float _trail = -1f; internal void Set(float fraction, float trail = -1f, bool force = false) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) fraction = Mathf.Clamp01(fraction); if (force || Mathf.Abs(fraction - _fill) > 0.0005f) { _fill = fraction; ((Graphic)Fill).rectTransform.anchorMax = new Vector2(fraction, 1f); ((Behaviour)Fill).enabled = fraction > 0.002f; } if (!((Object)(object)Trail == (Object)null)) { trail = Mathf.Clamp01(Mathf.Max(trail, _fill)); if (force || Mathf.Abs(trail - _trail) > 0.0005f) { _trail = trail; ((Graphic)Trail).rectTransform.anchorMax = new Vector2(trail, 1f); } ((Behaviour)Trail).enabled = _trail > _fill + 0.002f; } } internal void SetColor(Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (((Graphic)Fill).color != color) { ((Graphic)Fill).color = color; } } internal void SetText(string text) { GameUi.SetText(Text, text ?? ""); GameUi.SetText(Shadow, text ?? ""); } internal void SetActive(bool on) { if (((Component)Groove).gameObject.activeSelf != on) { ((Component)Groove).gameObject.SetActive(on); } } } private const string CanvasName = "RecyclerCanvas"; internal static Func<bool> IsOpen = () => false; internal static TMP_FontAsset Norse; internal static TMP_FontAsset Serif; internal static TMP_FontAsset Sans; private static Image _panel; private static Image _sunken; private static Image _braid; private static Button _button; private static Button _tab; private static GameObject _cell; private static float _cellSpace = 70f; private static bool _warned; internal static readonly Color Warm = new Color(1f, 0.86f, 0.55f); internal static readonly Color Text = new Color(0.94f, 0.9f, 0.82f); internal static readonly Color Dim = new Color(0.75f, 0.72f, 0.66f); internal static readonly Color Gold = new Color(1f, 0.78f, 0.3f); internal static readonly Color Warn = new Color(1f, 0.55f, 0.35f); internal static readonly Color Good = new Color(0.6f, 0.9f, 0.55f); private static Canvas _canvas; internal static Transform Canvas { get { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown if ((Object)(object)_canvas != (Object)null) { Match(); return ((Component)_canvas).transform; } InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null) { return null; } foreach (Transform item in (from Transform t in (IEnumerable)((Component)instance).transform.parent where ((Object)t).name == "RecyclerCanvas" select t).ToList()) { Object.Destroy((Object)(object)((Component)item).gameObject); } Canvas val = ((Component)instance).GetComponentInChildren<Canvas>(true) ?? ((Component)instance).GetComponentInParent<Canvas>(); GameObject val2 = new GameObject("RecyclerCanvas", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(((Component)instance).transform.parent, false); _canvas = val2.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = (((Object)(object)val != (Object)null) ? val.sortingOrder : 0) + 5; val2.AddComponent<CanvasScaler>(); val2.AddComponent<GraphicRaycaster>(); Match(); return ((Component)_canvas).transform; } } internal static float CellSpace => _cellSpace; internal static Transform HudRoot { get { if (!((Object)(object)Hud.instance != (Object)null) || !((Object)(object)Hud.instance.m_rootObject != (Object)null)) { return null; } return Hud.instance.m_rootObject.transform; } } internal static Vector2 ScreenSize { get { //IL_003c: 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) //IL_0062: Invalid comparison between Unknown and I4 //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a5: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Invalid comparison between Unknown and I4 //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 Transform canvas = Canvas; CanvasScaler val = (((Object)(object)canvas != (Object)null) ? ((Component)canvas).GetComponent<CanvasScaler>() : null); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor((float)Screen.width, (float)Screen.height); float num = 1f; if ((Object)(object)val != (Object)null && (int)val.uiScaleMode == 0) { num = val.scaleFactor; } else if ((Object)(object)val != (Object)null && (int)val.uiScaleMode == 1 && val.referenceResolution.x > 0f && val.referenceResolution.y > 0f) { float num2 = val2.x / val.referenceResolution.x; float num3 = val2.y / val.referenceResolution.y; num = (((int)val.screenMatchMode == 1) ? Mathf.Min(num2, num3) : (((int)val.screenMatchMode == 2) ? Mathf.Max(num2, num3) : Mathf.Pow(2f, Mathf.Lerp(Mathf.Log(num2, 2f), Mathf.Log(num3, 2f), val.matchWidthOrHeight)))); } else if ((Object)(object)_canvas != (Object)null) { num = _canvas.scaleFactor; } return val2 / Mathf.Max(0.01f, num); } } internal static bool Typing { get { EventSystem current = EventSystem.current; GameObject val = (((Object)(object)current != (Object)null) ? current.currentSelectedGameObject : null); TMP_InputField val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<TMP_InputField>() : null); if ((Object)(object)val2 != (Object)null) { return val2.isFocused; } return false; } } private static void Match() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) InventoryGui instance = InventoryGui.instance; CanvasScaler val = (((Object)(object)_canvas != (Object)null) ? ((Component)_canvas).GetComponent<CanvasScaler>() : null); CanvasScaler val2 = (((Object)(object)instance != (Object)null) ? (((Component)instance).GetComponentInChildren<CanvasScaler>(true) ?? ((Component)instance).GetComponentInParent<CanvasScaler>()) : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { val.uiScaleMode = val2.uiScaleMode; val.referenceResolution = val2.referenceResolution; val.screenMatchMode = val2.screenMatchMode; val.matchWidthOrHeight = val2.matchWidthOrHeight; val.scaleFactor = val2.scaleFactor; val.referencePixelsPerUnit = val2.referencePixelsPerUnit; } } internal static void Destroy() { if ((Object)(object)_canvas != (Object)null) { Object.Destroy((Object)(object)((Component)_canvas).gameObject); } _canvas = null; _panel = null; _button = null; _cell = null; IsOpen = () => false; } internal static bool Ready() { if ((Object)(object)_button != (Object)null && (Object)(object)_panel != (Object)null && (Object)(object)_cell != (Object)null) { return true; } InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null) { return false; } Transform root = ((Component)instance).transform; _panel = Find<Image>("root/Crafting/Bkg") ?? Find<Image>("root/Player/Bkg"); _sunken = Find<Image>("root/Player/sunken"); _braid = Find<Image>("root/Crafting/BraidLineHorisontalMedium"); _button = Find<Button>("root/Player/Container/TakeAll"); _tab = Find<Button>("root/Crafting/TabsButtons/Craft"); TMP_Text obj = Find<TMP_Text>("root/Crafting/topic"); Norse = ((obj != null) ? obj.font : null); TMP_Text obj2 = Find<TMP_Text>("root/Crafting/TabsButtons/Craft/Text"); Serif = ((obj2 != null) ? obj2.font : null); TMP_Text obj3 = Find<TMP_Text>("root/Crafting/Decription/Description"); Sans = ((obj3 != null) ? obj3.font : null) ?? Serif; InventoryGrid playerGrid = instance.m_playerGrid; if ((Object)(object)playerGrid != (Object)null) { _cell = playerGrid.m_elementPrefab; _cellSpace = ((playerGrid.m_elementSpace > 1f) ? playerGrid.m_elementSpace : 70f); } if (((Object)(object)_button == (Object)null || (Object)(object)_panel == (Object)null || (Object)(object)_cell == (Object)null) && !_warned) { _warned = true; Debug.LogWarning((object)"RecyclerCanvas: the game's interface was not found where expected (a game update moved it?)"); } if ((Object)(object)_button != (Object)null && (Object)(object)_panel != (Object)null) { return (Object)(object)_cell != (Object)null; } return false; T Find<T>(string path) where T : Component { Transform val = root.Find(path); if (!((Object)(object)val != (Object)null)) { return default(T); } return ((Component)val).GetComponent<T>(); } } internal static RectTransform Rect(Transform parent, string name, Vector2 anchor, Vector2 pivot, Vector2 pos, Vector2 size) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(parent, false); Vector2 anchorMin = (val2.anchorMax = anchor); val2.anchorMin = anchorMin; val2.pivot = pivot; val2.anchoredPosition = pos; val2.sizeDelta = size; return val2; } internal static RectTransform Window(string name, Vector2 size) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(Canvas, name, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, size); Copy(_panel, ((Component)val).gameObject.AddComponent<Image>()); return val; } internal static RectTransform Box(Transform parent, Vector2 pos, Vector2 size) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(parent, "Box", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); if ((Object)(object)_sunken != (Object)null) { Copy(_sunken, val2); } else { ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.35f); } return val; } internal static void Braid(Transform parent, Vector2 pos, float width) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_braid == (Object)null)) { Vector2 anchor = new Vector2(0.5f, 1f); Vector2 pivot = new Vector2(0.5f, 0.5f); Rect rect = ((Graphic)_braid).rectTransform.rect; float num; if (!(((Rect)(ref rect)).height > 1f)) { num = 16f; } else { rect = ((Graphic)_braid).rectTransform.rect; num = ((Rect)(ref rect)).height; } RectTransform val = Rect(parent, "Braid", anchor, pivot, pos, new Vector2(width, num)); Copy(_braid, ((Component)val).gameObject.AddComponent<Image>()); } } private static void Copy(Image from, Image to) { //IL_0018: 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) if (!((Object)(object)from == (Object)null)) { to.sprite = from.sprite; to.type = from.type; ((Graphic)to).material = ((Graphic)from).material; ((Graphic)to).color = ((Graphic)from).color; to.pixelsPerUnitMultiplier = from.pixelsPerUnitMultiplier; to.fillCenter = from.fillCenter; } } internal static TMP_Text Label(Transform parent, string text, Vector2 pos, Vector2 size, float fontSize, Color color, TMP_FontAsset font = null, TextAlignmentOptions align = (TextAlignmentOptions)257, Vector2? anchor = null) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (Vector2)(((??)anchor) ?? new Vector2(0f, 1f)); RectTransform val2 = Rect(parent, "Text", val, val, pos, size); bool activeSelf = ((Component)val2).gameObject.activeSelf; ((Component)val2).gameObject.SetActive(false); TextMeshProUGUI val3 = ((Component)val2).gameObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).font = font ?? Sans; ((Component)val2).gameObject.SetActive(activeSelf); ((TMP_Text)val3).fontSize = fontSize; ((Graphic)val3).color = color; ((TMP_Text)val3).alignment = align; ((TMP_Text)val3).richText = true; ((TMP_Text)val3).textWrappingMode = (TextWrappingModes)1; ((TMP_Text)val3).overflowMode = (TextOverflowModes)0; ((TMP_Text)val3).text = text; ((Graphic)val3).raycastTarget = false; return (TMP_Text)(object)val3; } internal static Button Button(Transform parent, string text, Vector2 pos, Vector2 size, Action click, bool enabled = true, float fontSize = 18f) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown Button val = Clone(_button, parent, text, pos, size, fontSize); ((Selectable)val).interactable = enabled; ((Graphic)Label(val)).color = (enabled ? Text : Dim); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { click(); }); return val; } internal static Button Tab(Transform parent, string text, Vector2 pos, Vector2 size, bool chosen, Action click, float fontSize = 18f) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown Button val = Clone(_tab ?? _button, parent, text, pos, size, fontSize); Transform val2 = ((Component)val).transform.Find("Selected"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(false); } ((Selectable)val).interactable = !chosen; ((Graphic)Label(val)).color = (chosen ? Gold : Text); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { click(); }); return val; } internal static TMP_Text Label(Button b) { return ((IEnumerable<TMP_Text>)((Component)b).GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => ((Component)t).gameObject.activeSelf)); } private static Button Clone(Button template, Transform parent, string text, Vector2 pos, Vector2 size, float fontSize) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_0197: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)template).gameObject, parent, false); ((Object)val).name = "Button"; val.SetActive(true); foreach (Transform item in ((IEnumerable)val.transform).Cast<Transform>().ToList()) { if (((Object)item).name.StartsWith("gamepad_hint")) { Object.Destroy((Object)(object)((Component)item).gameObject); } } UIGamePad[] componentsInChildren = val.GetComponentsInChildren<UIGamePad>(true); foreach (UIGamePad val2 in componentsInChildren) { Object.Destroy((Object)(object)val2); } ButtonTextColor[] componentsInChildren2 = val.GetComponentsInChildren<ButtonTextColor>(true); foreach (ButtonTextColor val3 in componentsInChildren2) { Object.Destroy((Object)(object)val3); } Localize[] componentsInChildren3 = val.GetComponentsInChildren<Localize>(true); foreach (Localize val4 in componentsInChildren3) { Object.Destroy((Object)(object)val4); } RectTransform val5 = (RectTransform)val.transform; Vector2 val6 = default(Vector2); ((Vector2)(ref val6))..ctor(0f, 1f); val5.anchorMax = val6; val5.anchorMin = val6; val5.pivot = new Vector2(0f, 1f); val5.anchoredPosition = pos; val5.sizeDelta = size; Button component = val.GetComponent<Button>(); component.onClick = new ButtonClickedEvent(); TMP_Text val7 = ((IEnumerable<TMP_Text>)val.GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => ((Object)t).name == "Text")); if ((Object)(object)val7 == (Object)null) { val7 = Label(val.transform, text, Vector2.zero, size, fontSize, Text, Serif, (TextAlignmentOptions)514, (Vector2?)new Vector2(0.5f, 0.5f)); ((RectTransform)val7.transform).pivot = new Vector2(0.5f, 0.5f); } val7.text = text; val7.fontSize = fontSize; val7.enableAutoSizing = false; val7.textWrappingMode = (TextWrappingModes)0; val7.overflowMode = (TextOverflowModes)1; RectTransform val8 = (RectTransform)val7.transform; val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; val8.offsetMin = new Vector2(4f, 0f); val8.offsetMax = new Vector2(-4f, 0f); val7.alignment = (TextAlignmentOptions)514; TMP_Text[] componentsInChildren4 = val.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val9 in componentsInChildren4) { if ((Object)(object)val9 != (Object)(object)val7) { ((Component)val9).gameObject.SetActive(false); } } return component; } internal static Image Icon(Transform parent, Vector2 pos, Vector2 size, Sprite sprite) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Image val = ((Component)Rect(parent, "Icon", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size)).gameObject.AddComponent<Image>(); val.sprite = sprite; val.preserveAspect = true; ((Graphic)val).raycastTarget = false; ((Behaviour)val).enabled = (Object)(object)sprite != (Object)null; return val; } internal static float Chip(Transform parent, Vector2 pos, ItemData item, string amount, float size = 28f, float fontSize = 17f, Color? color = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) Image val = Icon(parent, pos, new Vector2(size, size), item.GetIcon()); ((Graphic)val).raycastTarget = true; UITooltip val2 = ((!((Object)(object)_cell != (Object)null)) ? null : _cell.GetComponent<InventoryElement>()?.m_tooltip); if ((Object)(object)val2 != (Object)null) { UITooltip val3 = ((Component)val).gameObject.AddComponent<UITooltip>(); val3.m_tooltipPrefab = val2.m_tooltipPrefab; val3.Set(item.m_shared.m_name, item.GetTooltip(-1), (RectTransform)null, default(Vector2)); } TMP_Text val4 = Label(parent, amount, new Vector2(pos.x + size + 3f, pos.y - (size - fontSize * 1.3f) / 2f), new Vector2(80f, size), fontSize, (Color)(((??)color) ?? Text), null, (TextAlignmentOptions)257); val4.textWrappingMode = (TextWrappingModes)0; float x = val4.GetPreferredValues(amount, 200f, 0f).x; ((RectTransform)val4.transform).sizeDelta = new Vector2(x + 2f, size); return size + 3f + x + 12f; } internal static RectTransform Bar(Transform parent, Vector2 pos, Vector2 size, float fraction, Color fill, string text, float fontSize = 15f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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) RectTransform val = Box(parent, pos, size); RectTransform val2 = Rect((Transform)(object)val, "Fill", new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(2f, 2f), new Vector2(0f, 0f)); val2.anchorMax = new Vector2(0f, 1f); val2.offsetMax = new Vector2(2f + (size.x - 4f) * Mathf.Clamp01(fraction), -2f); Image val3 = ((Component)val2).gameObject.AddComponent<Image>(); ((Graphic)val3).color = new Color(fill.r * 0.8f, fill.g * 0.8f, fill.b * 0.8f, 0.9f); ((Graphic)val3).raycastTarget = false; if (!string.IsNullOrEmpty(text)) { bool[] array = new bool[2] { true, false }; foreach (bool flag in array) { TMP_Text val4 = Label((Transform)(object)val, text, new Vector2(flag ? 1f : 0f, flag ? (-1f) : 0f), size, fontSize, (Color)(flag ? new Color(0f, 0f, 0f, 0.85f) : Color.white), Sans, (TextAlignmentOptions)514); val4.textWrappingMode = (TextWrappingModes)0; } } return val; } internal static InventoryElement Cell(Transform parent, Vector2 pos, ItemData item, string amount, bool selected, Action click) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(_cell, parent, false); ((Object)val).name = "Cell"; val.SetActive(true); UIDragHandler[] componentsInChildren = val.GetComponentsInChildren<UIDragHandler>(true); foreach (UIDragHandler val2 in componentsInChildren) { Object.Destroy((Object)(object)val2); } UIGamePad[] componentsInChildren2 = val.GetComponentsInChildren<UIGamePad>(true); foreach (UIGamePad val3 in componentsInChildren2) { Object.Destroy((Object)(object)val3); } RectTransform val4 = (RectTransform)val.transform; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0f, 1f); val4.anchorMax = val5; val4.anchorMin = val5; val4.pivot = new Vector2(0f, 1f); val4.anchoredPosition = pos; InventoryElement component = val.GetComponent<InventoryElement>(); component.Initialize(0, 0); Transform val6 = val.transform.Find("binding"); if ((Object)(object)val6 != (Object)null) { TMP_Text component2 = ((Component)val6).GetComponent<TMP_Text>(); if (component2 != null) { ((Behaviour)component2).enabled = false; } } ((Behaviour)component.m_icon).enabled = true; component.m_icon.sprite = item.GetIcon(); ((Graphic)component.m_icon).color = Color.white; bool flag = item.m_shared.m_useDurability && item.m_durability < item.GetMaxDurability(); ((Component)component.m_durability).gameObject.SetActive(flag); if (flag) { component.m_durability.SetValue(item.GetDurabilityPercentage()); } ((Behaviour)component.m_equiped).enabled = item.m_equipped; ((Behaviour)component.m_queued).enabled = false; ((Behaviour)component.m_noteleport).enabled = false; ((Behaviour)component.m_food).enabled = false; ((Behaviour)component.m_quality).enabled = amount == null && item.m_shared.m_maxQuality > 1; if (((Behaviour)component.m_quality).enabled) { component.m_quality.text = item.m_quality.ToString(); } ((Behaviour)component.m_amount).enabled = amount != null || item.m_shared.m_maxStackSize > 1; component.m_amount.text = amount ?? $"{item.m_stack}/{item.m_shared.m_maxStackSize}"; if ((Object)(object)component.m_selected != (Object)null) { component.m_selected.SetActive(selected); } UITooltip tooltip = component.m_tooltip; string name = item.m_shared.m_name; string tooltip2 = item.GetTooltip(-1); val5 = default(Vector2); tooltip.Set(name, tooltip2, (RectTransform)null, val5); UIInputHandler componentInChildren = val.GetComponentInChildren<UIInputHandler>(true); if ((Object)(object)componentInChildren != (Object)null && click != null) { componentInChildren.m_onLeftClick = delegate { click(); }; } return component; } internal static RectTransform Scroll(RectTransform box, float inset) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_023d: 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_0269: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown InventoryGui gui = InventoryGui.instance; ScrollRect val = (((Object)(object)gui != (Object)null) ? ((IEnumerable<ScrollRect>)((Component)gui).GetComponentsInChildren<ScrollRect>(true)).FirstOrDefault((Func<ScrollRect, bool>)((ScrollRect s) => (Object)(object)s.content == (Object)(object)gui.m_recipeListRoot)) : null); Scrollbar val2 = (((Object)(object)gui != (Object)null) ? gui.m_recipeListScroll : null); float num; if (!((Object)(object)val2 != (Object)null)) { num = 0f; } else { Rect rect = ((RectTransform)((Component)val2).transform).rect; num = Mathf.Max(8f, ((Rect)(ref rect)).width); } float num2 = num; RectTransform val3 = Rect((Transform)(object)box, "View", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(inset, 0f - inset), box.sizeDelta - new Vector2(inset * 2f + ((num2 > 0f) ? (num2 + 4f) : 0f), inset * 2f)); ((Component)val3).gameObject.AddComponent<RectMask2D>(); Image val4 = ((Component)val3).gameObject.AddComponent<Image>(); ((Graphic)val4).color = Color.clear; RectTransform val5 = Rect((Transform)(object)val3, "Content", new Vector2(0f, 1f), new Vector2(0f, 1f), Vector2.zero, new Vector2(val3.sizeDelta.x, 0f)); ScrollRect val6 = ((Component)val3).gameObject.AddComponent<ScrollRect>(); val6.content = val5; val6.viewport = val3; val6.horizontal = false; val6.movementType = (MovementType)2; val6.scrollSensitivity = (((Object)(object)val != (Object)null && val.scrollSensitivity > 0f) ? val.scrollSensitivity : 300f); val6.inertia = false; if ((Object)(object)val2 != (Object)null) { GameObject val7 = Object.Instantiate<GameObject>(((Component)val2).gameObject, (Transform)(object)box, false); ((Object)val7).name = "Scrollbar"; val7.SetActive(true); UIGamePad[] componentsInChildren = val7.GetComponentsInChildren<UIGamePad>(true); foreach (UIGamePad val8 in componentsInChildren) { Object.Destroy((Object)(object)val8); } RectTransform val9 = (RectTransform)val7.transform; val9.anchorMin = new Vector2(1f, 0f); val9.anchorMax = new Vector2(1f, 1f); val9.pivot = new Vector2(1f, 0.5f); val9.sizeDelta = new Vector2(num2, (0f - inset) * 2f); val9.anchoredPosition = new Vector2((0f - inset) * 0.5f, 0f); Scrollbar component = val7.GetComponent<Scrollbar>(); component.onValueChanged = new ScrollEvent(); val6.verticalScrollbar = component; val6.verticalScrollbarVisibility = (ScrollbarVisibility)1; } return val5; } internal static Button Toggle(Transform parent, string text, bool on, Vector2 pos, Vector2 size, Action click, float fontSize = 17f, Sprite icon = null) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Button val = Button(parent, text + ": " + Localization.instance.Localize(on ? "$hud_on" : "$hud_off"), pos, size, click, enabled: true, fontSize); TMP_Text val2 = Label(val); ((Graphic)val2).color = (on ? Gold : Text); if ((Object)(object)icon != (Object)null) { float num = Mathf.Max(16f, size.y - 12f); Image val3 = Icon(((Component)val).transform, new Vector2(8f, (0f - (size.y - num)) / 2f), new Vector2(num, num), icon); ((Graphic)val3).color = (Color)(on ? Color.white : new Color(1f, 1f, 1f, 0.4f)); ((RectTransform)val2.transform).offsetMin = new Vector2(num + 14f, 0f); val2.alignment = (TextAlignmentOptions)513; } return val; } internal static TMP_Text Stepper(Transform parent, Vector2 pos, float height, string value, int[] steps, Action<int> change, float buttonW = 48f, float valueW = 76f, float fontSize = 16f) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) float num = pos.x; for (int i = 0; i < steps.Length; i++) { int num2 = steps[i]; int d = -num2; Button(parent, "-" + num2, new Vector2(num, pos.y), new Vector2(buttonW, height), delegate { change(d); }, enabled: true, fontSize); num += buttonW + 4f; } RectTransform parent2 = Box(parent, new Vector2(num, pos.y), new Vector2(valueW, height)); TMP_Text val = Label((Transform)(object)parent2, value, Vector2.zero, new Vector2(valueW, height), fontSize + 2f, Text, Sans, (TextAlignmentOptions)514); val.textWrappingMode = (TextWrappingModes)0; num += valueW + 4f; foreach (int item in steps.Reverse()) { int d2 = item; Button(parent, "+" + item, new Vector2(num, pos.y), new Vector2(buttonW, height), delegate { change(d2); }, enabled: true, fontSize); num += buttonW + 4f; } return val; } internal static float StepperWidth(int steps, float buttonW = 48f, float valueW = 76f) { return (float)steps * 2f * (buttonW + 4f) + valueW; } internal static TMP_Text Line(Transform parent, string text, Vector2 pos, float width, float fontSize, Color color, TMP_FontAsset font = null, TextAlignmentOptions align = (TextAlignmentOptions)257, Vector2? anchor = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected I4, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) float num = fontSize * 1.35f; float num2 = fontSize * 1.8f; int num3 = align & 0xFF00; if (num3 != 256) { pos.y += ((num3 == 1024) ? (num2 - num) : ((num2 - num) / 2f)); } TMP_Text val = Label(parent, text, pos, new Vector2(width, num2), fontSize, color, font, align, anchor); val.textWrappingMode = (TextWrappingModes)0; val.overflowMode = (TextOverflowModes)1; return val; } internal static float Width(TMP_Text like, string text) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return like.GetPreferredValues(text, 4000f, 0f).x; } internal static RawImage Picture(Transform parent, Vector2 pos, Vector2 size, Texture texture) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) RectTransform parent2 = Rect(parent, "Picture", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size); Vector2 size2 = size; if ((Object)(object)texture != (Object)null && texture.width > 0 && texture.height > 0) { float num = Mathf.Min(size.x / (float)texture.width, size.y / (float)texture.height); ((Vector2)(ref size2))..ctor((float)texture.width * num, (float)texture.height * num); } RectTransform val = Rect((Transform)(object)parent2, "Image", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, size2); RawImage val2 = ((Component)val).gameObject.AddComponent<RawImage>(); val2.texture = texture; ((Graphic)val2).raycastTarget = false; ((Behaviour)val2).enabled = (Object)(object)texture != (Object)null; return val2; } internal static Slider Slider(Transform parent, Vector2 pos, Vector2 size, float min, float max, float value, float step, Action<float> changed) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_01eb: 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_0204: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: 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_0255: Expected O, but got Unknown //IL_025d: 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) Slider val = (((Object)(object)InventoryGui.instance != (Object)null && (Object)(object)InventoryGui.instance.m_splitDialog != (Object)null) ? InventoryGui.instance.m_splitDialog.m_splitSlider : null); if ((Object)(object)val == (Object)null) { float current = Snap(value); Button(parent, "-", pos, new Vector2(size.y + 8f, size.y), delegate { current = Snap(current - step); changed(current); }); Button(parent, "+", new Vector2(pos.x + size.x - size.y - 8f, pos.y), new Vector2(size.y + 8f, size.y), delegate { current = Snap(current + step); changed(current); }); return null; } GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, parent, false); ((Object)val2).name = "Slider"; val2.SetActive(true); foreach (Transform item in (from t in val2.GetComponentsInChildren<Transform>(true) where ((Object)t).name.StartsWith("gamepad_hint") select t).ToList()) { Object.Destroy((Object)(object)((Component)item).gameObject); } UIGamePad[] componentsInChildren = val2.GetComponentsInChildren<UIGamePad>(true); foreach (UIGamePad val3 in componentsInChildren) { Object.Destroy((Object)(object)val3); } RectTransform val4 = (RectTransform)val2.transform; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0f, 1f); val4.anchorMax = val5; val4.anchorMin = val5; val4.pivot = new Vector2(0f, 0.5f); val4.anchoredPosition = new Vector2(pos.x, pos.y - size.y / 2f); val4.sizeDelta = size; Slider s = val2.GetComponent<Slider>(); s.onValueChanged = new SliderEvent(); Slider obj = s; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj).navigation = navigation; s.wholeNumbers = false; s.minValue = min; s.maxValue = max; s.SetValueWithoutNotify(Snap(value)); ((Selectable)s).interactable = true; ((UnityEvent<float>)(object)s.onValueChanged).AddListener((UnityAction<float>)delegate(float v) { float num2 = Snap(v); if (!Mathf.Approximately(num2, v)) { s.SetValueWithoutNotify(num2); } changed(num2); }); return s; float Snap(float v) { return Mathf.Clamp((step > 0f) ? (Mathf.Round(v / step) * step) : v, min, max); } } internal static void SetBar(RectTransform bar, float fraction, string text = null, Color? fill = null) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bar == (Object)null) { return; } Transform obj = ((Transform)bar).Find("Fill"); RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if ((Object)(object)val != (Object)null) { Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(2f + (bar.sizeDelta.x - 4f) * Mathf.Clamp01(fraction), -2f); if (val.offsetMax != val2) { val.offsetMax = val2; } if (fill.HasValue) { Image component = ((Component)val).GetComponent<Image>(); if (component != null) { Color value = fill.Value; Color val3 = default(Color); ((Color)(ref val3))..ctor(value.r * 0.8f, value.g * 0.8f, value.b * 0.8f, 0.9f); if (((Graphic)component).color != val3) { ((Graphic)component).color = val3; } } } } if (text == null) { return; } TMP_Text[] componentsInChildren = ((Component)bar).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val4 in componentsInChildren) { if (val4.text != text) { val4.text = text; } } } internal static RectTransform Board(Transform parent, string name, Vector2 pos, Vector2 size) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(parent, name, new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size); Copy(_panel, ((Component)val).gameObject.AddComponent<Image>()); return val; } internal static RectTransform Over(RectTransform panel, string name, Vector2 minSize) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Transform)panel).parent; foreach (Transform item in (from Transform t in (IEnumerable)parent where ((Object)t).name == name select t).ToList()) { Object.Destroy((Object)(object)((Component)item).gameObject); } Vector3[] array = (Vector3[])(object)new Vector3[4]; panel.GetWorldCorners(array); Vector2 val = Vector2.op_Implicit(parent.InverseTransformPoint(array[0])); Vector2 val2 = Vector2.op_Implicit(parent.InverseTransformPoint(array[2])); Transform val3 = ((Transform)panel).Find("Bkg"); RectTransform val4 = (RectTransform)(object)((val3 is RectTransform) ? val3 : null); if (val4 != null) { val4.GetWorldCorners(array); val = Vector2.Min(val, Vector2.op_Implicit(parent.InverseTransformPoint(array[0]))); val2 = Vector2.Max(val2, Vector2.op_Implicit(parent.InverseTransformPoint(array[2]))); } Vector2 size = Vector2.Max(val2 - val, minSize); Rect rect = ((RectTransform)parent).rect; RectTransform val5 = Rect(parent, name, new Vector2(0.5f, 0.5f), new Vector2(0f, 1f), new Vector2(val.x, val2.y) - ((Rect)(ref rect)).center, size); ((Transform)val5).SetSiblingIndex(((Transform)panel).GetSiblingIndex() + 1); Copy(_panel, ((Component)val5).gameObject.AddComponent<Image>()); return val5; } internal static RectTransform Stretch(RectTransform r, Vector2 offsetMin, Vector2 offsetMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) r.anchorMin = Vector2.zero; r.anchorMax = Vector2.one; r.pivot = new Vector2(0.5f, 0.5f); r.offsetMin = offsetMin; r.offsetMax = offsetMax; return r; } internal static RectTransform Tag(Transform parent, string text, Vector2 pos, float height, float fontSize, Color fill, Color textColor, Vector2? anchor = null) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (Vector2)(((??)anchor) ?? new Vector2(0f, 1f)); RectTransform val2 = Rect(parent, "Tag", val, val, pos, new Vector2(height, height)); Image val3 = ((Component)val2).gameObject.AddComponent<Image>(); ((Graphic)val3).color = fill; ((Graphic)val3).raycastTarget = false; TMP_Text val4 = Label((Transform)(object)val2, text, Vector2.zero, new Vector2(height, height), fontSize, textColor, Sans, (TextAlignmentOptions)514, (Vector2?)new Vector2(0.5f, 0.5f)); val4.textWrappingMode = (TextWrappingModes)0; Stretch((RectTransform)val4.transform, Vector2.zero, Vector2.zero); float num = Mathf.Max(3f, height * 0.3f); val2.sizeDelta = new Vector2(Mathf.Max(height, val4.GetPreferredValues(text, 1000f, 0f).x + num * 2f), height); return val2; } internal static RectTransform At(Transform parent, string name, float x, float y, float w, float h) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) return Rect(parent, name, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, 0f - y), new Vector2(w, h)); } internal static RectTransform Stretch(Transform parent, string name, float left = 0f, float bottom = 0f, float right = 0f, float top = 0f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(parent, name, Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = new Vector2(0f - left, 0f - bottom); val.offsetMax = new Vector2(right, top); return val; } internal static Image Plain(RectTransform r, Color color) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Image val = ((Component)r).gameObject.AddComponent<Image>(); ((Graphic)val).color = color; ((Graphic)val).raycastTarget = false; return val; } internal static RawImage Picture(Transform parent, Vector2 pos, Vector2 size) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) RawImage val = ((Component)Rect(parent, "Picture", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size)).gameObject.AddComponent<RawImage>(); ((Graphic)val).raycastTarget = false; ((Behaviour)val).enabled = false; return val; } internal static void Show(RawImage img, Texture texture, Color tint) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)img == (Object)null) { return; } if (((Graphic)img).color != tint) { ((Graphic)img).color = tint; } if (!((Object)(object)img.texture == (Object)(object)texture)) { img.texture = texture; ((Behaviour)img).enabled = (Object)(object)texture != (Object)null; if (!((Object)(object)texture == (Object)null) && texture.width > 0 && texture.height > 0) { Rect rect = ((Graphic)img).rectTransform.rect; Vector2 size = ((Rect)(ref rect)).size; float num = (float)texture.width / (float)texture.height; float num2 = ((size.y > 0f) ? (size.x / size.y) : 1f); img.uvRect = ((num > num2) ? new Rect(0.5f - num2 / num / 2f, 0f, num2 / num, 1f) : new Rect(0f, 0.5f - num / num2 / 2f, 1f, num / num2)); } } } internal static void SetText(TMP_Text label, string text) { if ((Object)(object)label != (Object)null && label.text != text) { label.text = text; } } internal static Sprite ArrowSprite() { Minimap instance = Minimap.instance; Image val = (((Object)(object)instance != (Object)null && (Object)(object)instance.m_smallMarker != (Object)null) ? ((Component)instance.m_smallMarker).GetComponentInChildren<Image>(true) : null); if (!((Object)(object)val != (Object)null)) { return null; } return val.sprite; } internal static Edge Frame(Transform parent, float width, float outset, Color color) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) Edge edge = new Edge(); edge.Sides = (Image[])(object)new Image[4] { Plain(Side("EdgeTop", new Vector2(0f, 1f), Vector2.one, new Vector2(0f - outset, outset - width), new Vector2(outset, outset)), color), Plain(Side("EdgeBottom", Vector2.zero, new Vector2(1f, 0f), new Vector2(0f - outset, 0f - outset), new Vector2(outset, width - outset)), color), Plain(Side("EdgeLeft", Vector2.zero, new Vector2(0f, 1f), new Vector2(0f - outset, width - outset), new Vector2(width - outset, outset - width)), color), Plain(Side("EdgeRight", new Vector2(1f, 0f), Vector2.one, new Vector2(outset - width, width - outset), new Vector2(outset, outset - width)), color) }; edge.SetColor(color, force: true); return edge; RectTransform Side(string name, Vector2 min, Vector2 max, Vector2 offMin, Vector2 offMax) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0034: 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_0042: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(parent, name, Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero); val.anchorMin = min; val.anchorMax = max; val.offsetMin = offMin; val.offsetMax = offMax; return val; } } internal static Meter LiveBar(Transform parent, Vector2 pos, Vector2 size, Color fill, bool trail = false, float fontSize = 0f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) Meter meter = new Meter(); bool flag = size.y >= 10f && (Object)(object)_sunken != (Object)null; if (flag) { meter.Groove = Box(parent, pos, size); ((Graphic)((Component)meter.Groove).GetComponent<Image>()).raycastTarget = false; } else { meter.Groove = Rect(parent, "Groove", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size); Plain(meter.Groove, new Color(0f, 0f, 0f, 0.6f)); } float num = (flag ? 2f : ((size.y >= 4f) ? 1f : 0f)); RectTransform inner = Stretch((Transform)(object)meter.Groove, "Inner", 0f - num, 0f - num, 0f - num, 0f - num); if (trail) { meter.Trail = Fill("Trail", new Color(1f, 0.92f, 0.85f, 0.55f)); } meter.Fill = Fill("Fill", fill); if (fontSize > 0f) { bool[] array = new bool[2] { true, false }; foreach (bool flag2 in array) { TMP_Text val = Label((Transform)(object)meter.Groove, "", Vector2.zero, size, fontSize, (Color)(flag2 ? new Color(0f, 0f, 0f, 0.85f) : Color.white), Sans, (TextAlignmentOptions)514); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = (Vector2)(flag2 ? new Vector2(1f, -1f) : Vector2.zero); val2.offsetMax = (Vector2)(flag2 ? new Vector2(1f, -1f) : Vector2.zero); val.textWrappingMode = (TextWrappingModes)0; val.overflowMode = (TextOverflowModes)0; if (flag2) { meter.Shadow = val; } else { meter.Text = val; } } } meter.Set(0f, 0f, force: true); return meter; Image Fill(string name, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) RectTransform val3 = Rect((Transform)(object)inner, name, Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero); val3.anchorMin = Vector2.zero; val3.anchorMax = new Vector2(0f, 1f); Vector2 offsetMin = (val3.offsetMax = Vector2.zero); val3.offsetMin = offsetMin; return Plain(val3, color); } } internal static TMP_InputField InputField(Transform parent, Vector2 pos, Vector2 size, string text, string placeholder, int limit, Action<string> changed, Action<string> submit = null, float fontSize = 18f) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: 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) TMP_InputField val = (((Object)(object)TextInput.instance != (Object)null) ? ((Component)TextInput.instance).GetComponentInChildren<TMP_InputField>(true) : null); if ((Object)(object)val == (Object)null && (Object)(object)Minimap.instance != (Object)null) { val = ((Component)Minimap.instance).GetComponentsInChildren<TMP_InputField>(true).FirstOrDefault(); } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"RecyclerCanvas: the game's text box was not found (a game update moved it?): building one"); } GameObject val2 = new GameObject("RecyclerCanvasHolder"); val2.SetActive(false); TMP_InputField val3; if ((Object)(object)val != (Object)null) { GameObject copy = Object.Instantiate<GameObject>(((Component)val).gameObject, val2.transform, false); val3 = copy.GetComponent<TMP_InputField>(); Type type = ((object)val3).GetType(); while (type != null && type != typeof(MonoBehaviour)) { FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (typeof(UnityEventBase).IsAssignableFrom(fieldInfo.FieldType) && !fieldInfo.FieldType.IsAbstract) { try { fieldInfo.SetValue(val3, Activator.CreateInstance(fieldInfo.FieldType)); } catch (Exception) { } } } type = type.BaseType; } UIGamePad[] componentsInChildren = copy.GetComponentsInChildren<UIGamePad>(true); foreach (UIGamePad val4 in componentsInChildren) { Object.DestroyImmediate((Object)(object)val4); } foreach (Transform item in (from c in copy.GetComponentsInChildren<Transform>(true) where (Object)(object)c != (Object)(object)copy.transform && ((Object)c).name.StartsWith("gamepad_hint") select c).ToList()) { if ((Object)(object)item != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)item).gameObject); } } Localize[] componentsInChildren2 = copy.GetComponentsInChildren<Localize>(true); foreach (Localize val5 in componentsInChildren2) { Object.DestroyImmediate((Object)(object)val5); } TMP_SelectionCaret[] componentsInChildren3 = copy.GetComponentsInChildren<TMP_SelectionCaret>(true); foreach (TMP_SelectionCaret val6 in componentsInChildren3) { Object.DestroyImmediate((Object)(object)((Component)val6).gameObject); } } else { val3 = BuildInputField(val2.transform); } GameObject gameObject = ((Component)val3).gameObject; ((Object)gameObject).name = "InputField"; gameObject.SetActive(true); RectTransform val7 = (RectTransform)gameObject.transform; ((Transform)val7).SetParent(parent, false); Object.Destroy((Object)(object)val2); Vector2 val8 = default(Vector2); ((Vector2)(ref val8))..ctor(0f, 1f); val7.anchorMax = val8; val7.anchorMin = val8; val7.pivot = new Vector2(0f, 1f); val7.anchoredPosition = pos; val7.sizeDelta = size; ((Transform)val7).localScale = Vector3.one; ((Transform)val7).localRotation = Quaternion.identity; val3.contentType = (ContentType)0; val3.lineType = (LineType)0; val3.characterLimit = limit; ((Selectable)val3).interactable = true; val3.richText = false; TMP_Text[] array = (TMP_Text[])(object)new TMP_Text[2] { val3.textComponent, (TMP_Text)/*isinst with value type is only supported in some contexts*/ }; foreach (TMP_Text val9 in array) { if (!((Object)(object)val9 == (Object)null)) { if ((Object)(object)val9.font == (Object)null) { val9.font = Sans; } val9.fontSize = fontSize; val9.enableAutoSizing = false; val9.textWrappingMode = (TextWrappingModes)0; val9.alignment = (TextAlignmentOptions)4097; } } Graphic placeholder2 = val3.placeholder; TMP_Text val10 = (TMP_Text)(object)((placeholder2 is TMP_Text) ? placeholder2 : null); if (val10 != null) { val10.text = placeholder ?? ""; } else if ((Object)(object)val3.placeholder != (Object)null) { ((Component)val3.placeholder).gameObject.SetActive(false); } val3.text = text ?? ""; if (changed != null) { ((UnityEvent<string>)(object)val3.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { changed(s ?? ""); }); } if (submit != null) { ((UnityEvent<string>)(object)val3.onSubmit).AddListener((UnityAction<string>)delegate(string s) { submit(s ?? ""); }); } return val3; } private static TMP_InputField BuildInputField(Transform holder) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(holder, "InputField", new Vector2(0f, 1f), new Vector2(0f, 1f), Vector2.zero, new Vector2(200f, 36f)); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); if ((Object)(object)_sunken != (Object)null) { Copy(_sunken, val2); } else { ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.45f); } RectTransform area = Rect((Transform)(object)val, "Text Area", Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero); area.anchorMax = Vector2.one; area.offsetMin = new Vector2(10f, 2f); area.offsetMax = new Vector2(-10f, -2f); ((Component)area).gameObject.AddComponent<RectMask2D>(); TMP_Text val3 = Part("Placeholder", Dim); val3.fontStyle = (FontStyles)2; TMP_Text textComponent = Part("Text", Text); TMP_InputField val4 = ((Component)val).gameObject.AddComponent<TMP_InputField>(); val4.textViewport = area; val4.textComponent = textComponent; val4.placeholder = (Graphic)(object)val3; ((Selectable)val4).targetGraphic = (Graphic)(object)val2; val4.fontAsset = Sans; val4.customCaretColor = true; val4.caretColor = Text; val4.selectionColor = new Color(1f, 0.78f, 0.3f, 0.35f); return val4; TMP_Text Part(string name, Color color) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) TMP_Text val5 = Label((Transform)(object)area, "", Vector2.zero, Vector2.zero, 18f, color, Sans, (TextAlignmentOptions)4097, Vector2.zero); ((Object)val5).name = name; RectTransform val6 = (RectTransform)val5.transform; val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; Vector2 offsetMin = (val6.offsetMax = Vector2.zero); val6.offsetMin = offsetMin; return val5; } } internal static string NoParse(string text) { return "<noparse>" + (text ?? "").Replace("</noparse>", "") + "</noparse>"; } } [HarmonyPatch(typeof(PlayerController), "TakeInput")] internal static class GameUi_PlayerControllerTakeInput { private static void Postfix(ref bool __result) { if (GameUi.IsOpen()) { __result = false; } } } [HarmonyPatch(typeof(Player), "TakeInput")] internal static class GameUi_PlayerTakeInput { private static void Postfix(ref bool __result) { if (GameUi.IsOpen()) { __result = false; } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] internal static class GameUi_UpdateMouseCapture { private static bool Prefix() { if (!GameUi.IsOpen()) { return true; } ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); return false; } } [HarmonyPatch(typeof(ZInput), "GetMouseScrollWheel")] internal static class GameUi_ScrollWheel { private static void Postfix(ref float __result) { if (GameUi.IsOpen()) { __result = 0f; } } } [HarmonyPatch(typeof(Menu), "Update")] internal static class GameUi_EscapeCloses { internal static Action Close = delegate { }; private static bool Prefix() { if (!GameUi.IsOpen()) { return true; } if (!ZInput.GetKeyDown((KeyCode)27, true) && !ZInput.GetButtonDown("JoyMenu")) { return true; } Close(); return false; } } [HarmonyPatch(typeof(Minimap), "InTextInput")] internal static class GameUi_InTextInput { private static void Postfix(ref bool __result) { if (GameUi.IsOpen()) { __result = true; } } } [HarmonyPatch(typeof(InventoryGui), "Update")] internal static class GameUi_InventoryKey { private static void Prefix() { if (GameUi.IsOpen() && (ZInput.GetButtonDown("Inventory") || ZInput.GetButtonDown("JoyButtonY"))) { bool typing = GameUi.Typing; ZInput.ResetButtonStatus("Inventory"); ZInput.ResetButtonStatus("JoyButtonY"); if (!typing) { GameUi_EscapeCloses.Close(); } } } } internal enum Mat { Stone, Planks, Dark, Iron, Coal, Teal } internal static class Look { private static readonly Dictionary<Mat, Material> Materials = new Dictionary<Mat, Material>(); private static readonly Dictionary<Mat, Color> Fallback = new Dictionary<Mat, Color> { { Mat.Stone, new Color(0.45f, 0.45f, 0.47f) }, { Mat.Planks, new Color(0.45f, 0.3f, 0.17f) }, { Mat.Dark, new Color(0.22f, 0.15f, 0.1f) }, { Mat.Iron, new Color(0.35f, 0.35f, 0.38f) }, { Mat.Coal, new Color(0.16f, 0.16f, 0.18f) }, { Mat.Teal, new Color(0.25f, 0.75f, 0.8f) } }; private static Material Find(ZNetScene scene, string prefab, string material) { GameObject prefab2 = scene.GetPrefab(prefab); if ((Object)(object)prefab2 == (Object)null) { return null; } Renderer[] componentsInChildren = prefab2.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null && ((Object)val2).name == material) { return val2; } } } return null; } internal static void Harvest(ZNetScene scene, Material plain) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown Materials.Clear(); Materials[Mat.Stone] = Find(scene, "stone_wall_1x1", "stone_mat"); Materials[Mat.Planks] = Find(scene, "wood_floor", "woodwall"); Materials[Mat.Dark] = Find(scene, "darkwood_pole", "DarkWood_mat"); Materials[Mat.Iron] = Find(scene, "iron_grate", "metalwall"); Material val = Find(scene, "piece_cauldron", "cauldron_chain"); Materials[Mat.Coal] = val; Material val2 = (((Object)(object)val != (Object)null) ? val : plain); Material val3 = new Material(val2) { color = Fallback[Mat.Teal] }; if (val3.HasProperty("_EmissionColor")) { val3.EnableKeyword("_EMISSION"); val3.SetColor("_EmissionColor", Fallback[Mat.Teal] * 0.9f); } Materials[Mat.Teal] = val3; foreach (Mat item in Fallback.Keys.ToList()) { if (!Materials.TryGetValue(item, out var value) || !((Object)(object)value != (Object)null)) { Material val4 = new Material(plain) { color = Fallback[item] }; if (val4.HasProperty("_MainTex")) { val4.mainTexture = null; } Materials[item] = val4; } } Debug.Log((object)("[Recycler] materials: " + string.Join(", ", Materials.Select((KeyValuePair<Mat, Material> kv) => kv.Key.ToString() + "=" + ((Object)kv.Value).name).ToArray()))); } internal static Material Of(Mat m) { if (!Materials.TryGetValue(m, out var value)) { return null; } return value; } } internal static class Model { internal static readonly Vector3 RecyclerHitCenter = new Vector3(0f, 0.7f, 0f); internal static readonly Vector3 RecyclerHitSize = new Vector3(1.8f, 1.4f, 1.3f); internal static readonly Vector3 PressHitCenter = new Vector3(0f, 0.65f, 0f); internal static readonly Vector3 PressHitSize = new Vector3(1f, 1.3f, 1f); private static GameObject Add(Transform parent, string name, PrimitiveType shape, Vector3 pos, Vector3 size, Vector3 euler, Mat mat) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) GameObject val = GameObject.CreatePrimitive(shape); ((Object)val).name = name; Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>()); val.layer = ((Component)parent).gameObject.layer; Transform transform = val.transform; transform.SetParent(parent, false); transform.localPosition = pos; transform.localScale = size; transform.localRotation = Quaternion.Euler(euler); val.GetComponent<Renderer>().sharedMaterial = Look.Of(mat); return val; } private static GameObject Box(Transform p, string n, float x, float y, float z, float sx, float sy, float sz, Mat m, float rx = 0f, float ry = 0f, float rz = 0f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) return Add(p, n, (PrimitiveType)3, new Vector3(x, y, z), new Vector3(sx, sy, sz), new Vector3(rx, ry, rz), m); } private static void Roller(Transform parent, string name, float x, float y, float radius, float length, Mat body, Mat teeth) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(x, y, 0f); val.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); Add(val.transform, "drum", (PrimitiveType)2, Vector3.zero, new Vector3(radius * 2f, length * 0.5f, radius * 2f), Vector3.zero, body); for (int i = 0; i < 8; i++) { float num = (float)i * 45f; float num2 = num * ((float)Math.PI / 180f); Add(val.transform, "tooth", (PrimitiveType)3, new Vector3(Mathf.Cos(num2) * radius, 0f, Mathf.Sin(num2) * radius), new Vector3(0.07f, length * 0.92f, 0.1f), new Vector3(0f, 0f - num, 0f), teeth); } val.AddComponent<Spinner>(); } private static void Wheel(Transform parent, string name, float x, float y) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(x, y, 0f); val.transform.localRotation = Quaternion.Euler(0f, 0f, 90f); Add(val.transform, "hub", (PrimitiveType)2, Vector3.zero, new Vector3(0.14f, 0.1f, 0.14f), Vector3.zero, Mat.Coal); Add(val.transform, "rim", (PrimitiveType)2, new Vector3(0f, 0.05f, 0f), new Vector3(0.62f, 0.03f, 0.62f), Vector3.zero, Mat.Iron); for (int i = 0; i < 4; i++) { Add(val.transform, "spoke", (PrimitiveType)3, new Vector3(0f, 0.05f, 0f), new Vector3(0.58f, 0.03f, 0.05f), new Vector3(0f, (float)i * 45f, 0f), Mat