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 Bounty Board v1.4.2
plugins/BountyBoard.dll
Decompiled 18 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 BountyBoard { public class BountyBoardStation : MonoBehaviour, Interactable, Hoverable { private ZNetView _nview; internal string Key { get { ZDO val = (((Object)(object)_nview != (Object)null && _nview.IsValid()) ? _nview.GetZDO() : null); if (val == null) { return "board"; } return ((ZDOID)(ref val.m_uid)).UserID + ":" + ((ZDOID)(ref val.m_uid)).ID; } } private void Awake() { _nview = ((Component)this).GetComponent<ZNetView>(); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || (Object)(object)user != (Object)(object)Player.m_localPlayer || Time.unscaledTime < Window.ClosedAt + 0.25f) { return false; } Window.Open(this); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { int num = (Plugin.Instance?.Current)?.Active.Count ?? 0; int num2 = Plugin.Instance?.ToClaim() ?? 0; string text = ((num2 > 0) ? ("<color=#9BE37A>" + Translations.T((num2 == 1) ? "bountyboard_hover_reward" : "bountyboard_hover_rewards", num2) + "</color>") : ((num > 0) ? Translations.T((num == 1) ? "bountyboard_hover_running" : "bountyboard_hover_running_many", num) : Translations.T("bountyboard_hover_daily"))); return Localization.instance.Localize(Translations.T("bountyboard_piece") + "\n[<color=yellow><b>$KEY_Use</b></color>] " + Translations.T("bountyboard_hover_read") + "\n<size=14>" + text + "</size>"); } public string GetHoverName() { return Translations.T("bountyboard_piece"); } public float GetHoverOffset() { return 0f; } internal static void PlayEffects(Vector3 at, bool done) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("piece_workbench") : null); CraftingStation val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<CraftingStation>() : null); if ((Object)(object)val2 != (Object)null) { (done ? val2.m_craftItemDoneEffects : val2.m_craftItemEffects).Create(at, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } } catch { } } } internal enum Kind { Hunt, Elite, Sweep, Gather } internal class Bounty { public string Id; public Kind Kind; public string Target; public int Count; public int Tier; public int Stars; public int Coins; public int Progress; public List<KeyValuePair<string, int>> Items = new List<KeyValuePair<string, int>>(); public HashSet<long> Claimed = new HashSet<long>(); public HashSet<long> Earned = new HashSet<long>(); public Bounty Copy() { return Parse(Serialize()); } public string Serialize() { string[] obj = new string[11] { Id, null, null, null, null, null, null, null, null, null, null }; int kind = (int)Kind; obj[1] = kind.ToString(); obj[2] = Target; obj[3] = Count.ToString(); obj[4] = Tier.ToString(); obj[5] = Stars.ToString(); obj[6] = Coins.ToString(); obj[7] = Progress.ToString(); obj[8] = string.Join(",", Items.Select((KeyValuePair<string, int> i) => i.Key + ":" + i.Value).ToArray()); obj[9] = string.Join(",", Claimed.Select((long c) => c.ToString(CultureInfo.InvariantCulture)).ToArray()); obj[10] = ((Earned == null) ? "*" : string.Join(",", Earned.Select((long c) => c.ToString(CultureInfo.InvariantCulture)).ToArray())); return string.Join("~", obj); } public static Bounty Parse(string text) { string[] array = text.Split(new char[1] { '~' }); if (array.Length < 10) { return null; } try { Bounty bounty = new Bounty { Id = array[0], Kind = (Kind)int.Parse(array[1]), Target = array[2], Count = int.Parse(array[3]), Tier = int.Parse(array[4]), Stars = int.Parse(array[5]), Coins = int.Parse(array[6]), Progress = int.Parse(array[7]) }; string[] array2 = array[8].Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text2 in array2) { string[] array3 = text2.Split(new char[1] { ':' }); if (array3.Length == 2) { bounty.Items.Add(new KeyValuePair<string, int>(array3[0], int.Parse(array3[1]))); } } string[] array4 = array[9].Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in array4) { bounty.Claimed.Add(long.Parse(s, CultureInfo.InvariantCulture)); } if (array.Length < 11 || array[10] == "*") { bounty.Earned = null; } else { string[] array5 = array[10].Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string s2 in array5) { bounty.Earned.Add(long.Parse(s2, CultureInfo.InvariantCulture)); } } return bounty; } catch (FormatException) { return null; } } } internal class State { public int Day = -1; public int Total; public List<Bounty> Posted = new List<Bounty>(); public List<Bounty> Active = new List<Bounty>(); public List<Bounty> Done = new List<Bounty>(); public string Serialize() { List<string> list = new List<string> { "S~" + Day + "~" + Total }; list.AddRange(Posted.Select((Bounty b) => "P~" + b.Serialize())); list.AddRange(Active.Select((Bounty b) => "A~" + b.Serialize())); list.AddRange(Done.Select((Bounty b) => "D~" + b.Serialize())); return string.Join("\n", list.ToArray()); } public static State Parse(string text) { State state = new State(); string[] array = (text ?? "").Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text2 in array) { if (text2.StartsWith("S~")) { string[] array2 = text2.Split(new char[1] { '~' }); if (array2.Length >= 3) { int.TryParse(array2[1], out state.Day); int.TryParse(array2[2], out state.Total); } } else { if (text2.Length <= 2) { continue; } Bounty bounty = Bounty.Parse(text2.Substring(2)); if (bounty != null) { if (text2[0] == 'P') { state.Posted.Add(bounty); } else if (text2[0] == 'A') { state.Active.Add(bounty); } else if (text2[0] == 'D') { state.Done.Add(bounty); } } } } return state; } } internal static class Rules { private class Hunt { public string Prefab; public int Min; public int Max; public int Value; public Hunt(string p, int min, int max, int v) { Prefab = p; Min = min; Max = max; Value = v; } } private class Gather { public string Item; public int Min; public int Max; public int Value; public Gather(string i, int min, int max, int v) { Item = i; Min = min; Max = max; Value = v; } } private class Reward { public string Item; public int Value; public int Min; public int Max; public Reward(string i, int v, int min, int max) { Item = i; Value = v; Min = min; Max = max; } } private static readonly string[] TierKeys = new string[7] { "", "defeated_eikthyr", "defeated_gdking", "defeated_bonemass", "defeated_dragon", "defeated_goblinking", "defeated_queen" }; internal static readonly string[] TierNames = new string[7] { "$biome_meadows", "$biome_blackforest", "$biome_swamp", "$biome_mountain", "$biome_plains", "$biome_mistlands", "$biome_ashlands" }; internal static readonly string[] StarNames = new string[4] { "", "$bountyboard_star_standard", "$bountyboard_star_hard", "$bountyboard_star_brutal" }; private static readonly Hunt[][] Hunts = new Hunt[7][] { new Hunt[4] { new Hunt("Boar", 3, 6, 9), new Hunt("Neck", 4, 8, 6), new Hunt("Greyling", 4, 8, 6), new Hunt("Deer", 3, 5, 7) }, new Hunt[5] { new Hunt("Greydwarf", 5, 10, 10), new Hunt("Greydwarf_Shaman", 3, 5, 16), new Hunt("Skeleton", 4, 8, 12), new Hunt("Greydwarf_Elite", 2, 4, 30), new Hunt("Troll", 1, 2, 90) }, new Hunt[6] { new Hunt("Draugr", 4, 8, 20), new Hunt("Draugr_Elite", 2, 3, 48), new Hunt("Blob", 5, 10, 14), new Hunt("Leech", 4, 8, 16), new Hunt("Wraith", 2, 4, 36), new Hunt("Surtling", 3, 5, 30) }, new Hunt[5] { new Hunt("Wolf", 3, 6, 32), new Hunt("Hatchling", 3, 5, 30), new Hunt("Fenring", 2, 4, 55), new Hunt("Ulv", 3, 5, 36), new Hunt("StoneGolem", 1, 2, 120) }, new Hunt[6] { new Hunt("Goblin", 4, 8, 30), new Hunt("GoblinArcher", 3, 6, 32), new Hunt("GoblinShaman", 2, 4, 52), new Hunt("GoblinBrute", 2, 3, 75), new Hunt("Deathsquito", 4, 8, 26), new Hunt("Lox", 1, 2, 125) }, new Hunt[5] { new Hunt("Seeker", 4, 7, 42), new Hunt("Tick", 4, 7, 32), new Hunt("SeekerBrute", 1, 2, 145), new Hunt("Gjall", 1, 2, 165), new Hunt("Dverger", 2, 4, 62) }, new Hunt[5] { new Hunt("Asksvin", 3, 5, 62), new Hunt("Charred_Melee", 4, 8, 48), new Hunt("Charred_Archer", 3, 6, 52), new Hunt("Volture", 2, 4, 48), new Hunt("Morgen", 1, 2, 210) } }; private static readonly Gather[][] Gathers = new Gather[7][] { new Gather[5] { new Gather("LeatherScraps", 6, 12, 5), new Gather("DeerHide", 3, 6, 9), new Gather("Feathers", 8, 16, 3), new Gather("RawMeat", 5, 10, 4), new Gather("BoneFragments", 8, 14, 3) }, new Gather[5] { new Gather("Resin", 10, 20, 3), new Gather("GreydwarfEye", 8, 14, 5), new Gather("Coal", 15, 25, 3), new Gather("TrollHide", 2, 4, 28), new Gather("Bronze", 4, 8, 12) }, new Gather[6] { new Gather("Bloodbag", 5, 10, 10), new Gather("Ooze", 5, 10, 9), new Gather("Entrails", 5, 10, 8), new Gather("IronScrap", 8, 14, 8), new Gather("ElderBark", 10, 16, 8), new Gather("WitheredBone", 2, 4, 42) }, new Gather[6] { new Gather("WolfPelt", 3, 6, 24), new Gather("WolfFang", 4, 8, 12), new Gather("Obsidian", 8, 14, 8), new Gather("FreezeGland", 4, 8, 14), new Gather("Silver", 3, 6, 26), new Gather("Crystal", 4, 8, 14) }, new Gather[6] { new Gather("LoxPelt", 3, 5, 42), new Gather("Needle", 6, 10, 14), new Gather("BlackMetalScrap", 8, 14, 14), new Gather("Flax", 10, 20, 5), new Gather("Barley", 10, 20, 5), new Gather("Tar", 5, 10, 12) }, new Gather[6] { new Gather("Carapace", 6, 12, 18), new Gather("Mandible", 2, 4, 55), new Gather("RoyalJelly", 4, 8, 20), new Gather("YggdrasilWood", 8, 14, 12), new Gather("Sap", 6, 10, 12), new Gather("Eitr", 2, 4, 40) }, new Gather[4] { new Gather("CharredBone", 6, 12, 15), new Gather("AskHide", 4, 8, 20), new Gather("MoltenCore", 1, 2, 200), new Gather("Flametal", 3, 6, 40) } }; private static readonly Reward[][] Rewards = new Reward[7][] { new Reward[4] { new Reward("Resin", 3, 10, 40), new Reward("Flint", 2, 10, 40), new Reward("Honey", 6, 3, 12), new Reward("LeatherScraps", 5, 6, 24) }, new Reward[5] { new Reward("Copper", 14, 2, 16), new Reward("Tin", 14, 2, 16), new Reward("Bronze", 22, 2, 14), new Reward("BronzeNails", 3, 10, 60), new Reward("CoreWood", 6, 10, 40) }, new Reward[5] { new Reward("Iron", 30, 2, 14), new Reward("IronNails", 3, 10, 60), new Reward("Chain", 25, 1, 6), new Reward("Bronze", 22, 2, 10), new Reward("ElderBark", 8, 10, 30) }, new Reward[5] { new Reward("Silver", 45, 2, 12), new Reward("Iron", 30, 3, 14), new Reward("WolfPelt", 25, 1, 6), new Reward("FreezeGland", 14, 2, 10), new Reward("Obsidian", 8, 5, 30) }, new Reward[4] { new Reward("BlackMetal", 60, 2, 12), new Reward("LinenThread", 10, 5, 30), new Reward("Silver", 45, 2, 10), new Reward("Flax", 5, 10, 40) }, new Reward[5] { new Reward("BlackMarble", 35, 3, 20), new Reward("YggdrasilWood", 25, 3, 16), new Reward("Eitr", 70, 1, 6), new Reward("Carapace", 18, 3, 16), new Reward("BlackMetal", 60, 2, 10) }, new Reward[4] { new Reward("Flametal", 100, 1, 8), new Reward("Grausten", 40, 3, 16), new Reward("MoltenCore", 120, 1, 3), new Reward("AskHide", 20, 3, 16) } }; private static readonly float[] CountFactor = new float[4] { 0f, 1f, 1.5f, 2.2f }; private static readonly float[] PayFactor = new float[4] { 0f, 1f, 1.7f, 2.8f }; internal static readonly int[] RankAt = new int[6] { 0, 5, 15, 30, 60, 100 }; internal static readonly string[] RankName = new string[6] { "$bountyboard_rank_newcomers", "$bountyboard_rank_hunters", "$bountyboard_rank_trackers", "$bountyboard_rank_slayers", "$bountyboard_rank_wardens", "$bountyboard_rank_legends" }; internal static readonly int[] RankBonus = new int[6] { 0, 5, 10, 15, 20, 25 }; private static bool Reached(int tier) { if (tier <= 0) { return true; } ZoneSystem instance = ZoneSystem.instance; if ((Object)(object)instance != (Object)null) { return instance.GetGlobalKey(TierKeys[tier]); } return false; } internal static int HighestTier() { int result = 0; for (int i = 1; i < TierKeys.Length; i++) { if (Reached(i)) { result = i; } } return result; } private static bool CreatureExists(string prefab) { if ((Object)(object)ZNetScene.instance != (Object)null) { return (Object)(object)ZNetScene.instance.GetPrefab(prefab) != (Object)null; } return false; } private static bool ItemExists(string item) { if ((Object)(object)ObjectDB.instance != (Object)null) { return (Object)(object)ObjectDB.instance.GetItemPrefab(item) != (Object)null; } return false; } internal static bool InTier(int tier, string prefab) { if (tier >= 0 && tier < Hunts.Length) { return Hunts[tier].Any((Hunt h) => h.Prefab == prefab); } return false; } internal static List<Bounty> MakeNotices(int day, int count) { Random random = new Random(day * 7919 + 104729); int num = HighestTier(); List<Bounty> list = new List<Bounty>(); HashSet<string> hashSet = new HashSet<string>(); Kind[] array = new Kind[8] { Kind.Hunt, Kind.Hunt, Kind.Sweep, Kind.Gather, Kind.Elite, Kind.Hunt, Kind.Gather, Kind.Sweep }; for (int i = 0; i < count; i++) { Kind kind = array[i % array.Length]; for (int j = 0; j < 6; j++) { int tier = ((random.NextDouble() < 0.6) ? num : random.Next(0, num + 1)); int stars = ((kind == Kind.Elite) ? 3 : RollStars(random, num)); Bounty bounty = Make(random, tier, kind, stars, "d" + day + "s" + i); if (bounty != null && hashSet.Add(bounty.Kind.ToString() + bounty.Target + bounty.Stars)) { list.Add(bounty); break; } } } return list; } private static int RollStars(Random rng, int top) { double num = rng.NextDouble(); double num2 = Math.Min(0.3, 0.02 + 0.045 * (double)top); double num3 = Math.Min(0.45, 0.14 + 0.07 * (double)top); if (!(num < num2)) { if (!(num < num2 + num3)) { return 1; } return 2; } return 3; } private static Bounty Make(Random rng, int tier, Kind kind, int stars, string id) { int num; string target; float num2; switch (kind) { case Kind.Gather: { List<Gather> list2 = Gathers[tier].Where((Gather g) => ItemExists(g.Item)).ToList(); if (list2.Count == 0) { return null; } Gather gather = list2[rng.Next(list2.Count)]; num = Mathf.Max(1, Mathf.RoundToInt((float)rng.Next(gather.Min, gather.Max + 1) * CountFactor[stars])); target = gather.Item; num2 = (float)(gather.Value * num) * 1.15f; break; } case Kind.Sweep: { List<Hunt> list3 = Hunts[tier].Where((Hunt h) => CreatureExists(h.Prefab)).ToList(); if (list3.Count < 2) { return null; } num = Mathf.RoundToInt((float)(10 + rng.Next(0, 6)) * CountFactor[stars] * (1f + (float)tier * 0.1f)); target = tier.ToString(); num2 = (float)list3.Average((Hunt h) => h.Value) * (float)num * 0.9f; break; } default: { List<Hunt> list = Hunts[tier].Where((Hunt h) => CreatureExists(h.Prefab)).ToList(); if (list.Count == 0) { return null; } Hunt hunt = list[rng.Next(list.Count)]; target = hunt.Prefab; if (kind == Kind.Elite) { num = rng.Next(1, 3 + ((tier >= 3) ? 1 : 0)); num2 = (float)(hunt.Value * num) * 2.6f; } else { num = Mathf.Max(1, Mathf.RoundToInt((float)rng.Next(hunt.Min, hunt.Max + 1) * CountFactor[stars])); num2 = hunt.Value * num; } break; } } num2 *= PayFactor[stars] * (float)Plugin.RewardPercent.Value / 100f * (0.9f + (float)rng.NextDouble() * 0.25f); Bounty bounty = new Bounty { Id = id, Kind = kind, Target = target, Count = num, Tier = tier, Stars = stars }; Pay(rng, bounty, num2); return bounty; } private static void Pay(Random rng, Bounty b, float value) { List<Reward> list = (from _ in Rewards[b.Tier] where ItemExists(_.Item) orderby rng.Next() select _).ToList(); int num = Mathf.Min(list.Count, (b.Stars < 2) ? 1 : 2); float num2 = 0f; for (int num3 = 0; num3 < num; num3++) { Reward reward = list[num3]; int num4 = Mathf.Clamp(Mathf.RoundToInt(value * 0.6f / (float)num / (float)reward.Value), reward.Min, reward.Max * b.Stars); b.Items.Add(new KeyValuePair<string, int>(reward.Item, num4)); num2 += (float)(num4 * reward.Value); } b.Coins = Mathf.Max(5, Mathf.RoundToInt(Mathf.Max(value * 0.4f, value - num2) / 5f) * 5); } internal static int Rank(int total) { int result = 0; for (int i = 0; i < RankAt.Length; i++) { if (total >= RankAt[i]) { result = i; } } return result; } internal static int WithBonus(int amount, int total) { return Mathf.CeilToInt((float)amount * (1f + (float)RankBonus[Rank(total)] / 100f)); } internal static string ItemName(string itemPrefab) { GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(itemPrefab) : null); ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); if (!((Object)(object)val2 != (Object)null)) { return itemPrefab; } return val2.m_itemData.m_shared.m_name; } internal static string TierName(int tier) { return Localization.instance.Localize(TierNames[Mathf.Clamp(tier, 0, TierNames.Length - 1)]); } internal static string TargetName(Bounty b) { if (b.Kind == Kind.Gather) { return Localization.instance.Localize(ItemName(b.Target)); } if (b.Kind == Kind.Sweep) { return Translations.T("bountyboard_sweep_target", TierName(int.Parse(b.Target))); } GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(b.Target) : null); Character val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<Character>() : null); if (!((Object)(object)val2 != (Object)null)) { return b.Target; } return Localization.instance.Localize(val2.m_name); } internal static string Describe(Bounty b) { if (b.Kind == Kind.Sweep) { return Translations.T("bountyboard_sweep", b.Count, TierName(int.Parse(b.Target))); } string key = ((b.Kind == Kind.Gather) ? "bountyboard_gather" : ((b.Kind == Kind.Elite) ? "bountyboard_elite" : "bountyboard_hunt")); return Translations.T(key, b.Count, TargetName(b)); } } 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 = "BountyBoardCanvas"; 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 == "BountyBoardCanvas" 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("BountyBoardCanvas", 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)"BountyBoardCanvas: 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_001f: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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); TextMeshProUGUI val3 = ((Component)val2).gameObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).font = font ?? Sans; ((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)"BountyBoardCanvas: the game's text box was not found (a game update moved it?): building one"); } GameObject val2 = new GameObject("BountyBoardCanvasHolder"); 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