using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [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 Saltanis.Economy { [HarmonyPatch] public sealed class CrewWallet : MonoBehaviour { [Serializable] private sealed class Account { public string Player = ""; public long Balance; public int LastParticipation = -1; } [Serializable] private sealed class Ledger { public List Wallets = new List(); public List RewardReceipts = new List(); } public const string SaveKey = "Saltanis.PersonalWallet.v1"; private static readonly JsonSerializerSettings JsonSettings = new JsonSerializerSettings { TypeNameHandling = (TypeNameHandling)0, MetadataPropertyHandling = (MetadataPropertyHandling)2, MaxDepth = 16 }; private const string LegacyKey = "saltanis.zabkowysklep.campaign.v1"; private const string IdentityMessage = "Saltanis.Wallet/1/identity"; private static CrewWallet instance; public static Func SupplementalSaleValue; private NetworkManager network; private string slot; private string localId; private Ledger ledger; private readonly Dictionary identities = new Dictionary(); private float nextPoll; private float nextIdentity; public static bool IsActive { get { if (Object.op_Implicit((Object)(object)instance)) { return instance.Ready(); } return false; } } public static event Action Paid; public static void Attach(GameObject owner) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)instance)) { instance = owner.GetComponent() ?? owner.AddComponent(); new Harmony("saltanis.personalwallet.v1").PatchAll(typeof(CrewWallet)); } } private unsafe void Update() { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) NetworkManager val = NetworkManager.Singleton; if (!Object.op_Implicit((Object)(object)val) || !val.IsListening || val.CustomMessagingManager == null) { val = null; } if (val != network) { if (Object.op_Implicit((Object)(object)network) && network.CustomMessagingManager != null) { network.CustomMessagingManager.UnregisterNamedMessageHandler("Saltanis.Wallet/1/identity"); network.OnClientDisconnectCallback -= Forget; } network = val; slot = null; ledger = null; identities.Clear(); nextIdentity = 0f; nextPoll = 0f; if (Object.op_Implicit((Object)(object)network) && val.CustomMessagingManager != null) { if (val.IsServer) { val.CustomMessagingManager.RegisterNamedMessageHandler("Saltanis.Wallet/1/identity", new HandleNamedMessageDelegate(Identity)); } val.OnClientDisconnectCallback += Forget; } } if (!Object.op_Implicit((Object)(object)network) || Time.unscaledTime < nextPoll) { return; } nextPoll = Time.unscaledTime + 0.35f; GameNetworkManager val2 = GameNetworkManager.Instance; if (Object.op_Implicit((Object)(object)val2) && val2.disableSteam && Object.op_Implicit((Object)(object)val2.localPlayerController)) { if (localId == null) { localId = ES3.Load("CompanyGym.LocalIdentity", "LCGeneralSaveData", ""); if (!Guid.TryParseExact(localId, "N", out var _)) { localId = Guid.NewGuid().ToString("N"); ES3.Save("CompanyGym.LocalIdentity", localId, "LCGeneralSaveData"); } } if (network.IsServer) { identities[network.LocalClientId] = localId; } else if (Time.unscaledTime >= nextIdentity && network.CustomMessagingManager != null) { nextIdentity = Time.unscaledTime + 3f; FastBufferWriter val3 = default(FastBufferWriter); ((FastBufferWriter)(ref val3))..ctor(136, (Allocator)2, -1); try { ((FastBufferWriter)(ref val3)).WriteValueSafe(localId, false); network.CustomMessagingManager.SendNamedMessage("Saltanis.Wallet/1/identity", 0uL, val3, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val3))/*cast due to .constrained prefix*/).Dispose(); } } } StartOfRound val4 = StartOfRound.Instance; if (!network.IsServer || !Object.op_Implicit((Object)(object)val4) || !val4.shipHasLanded || val4.shipIsLeaving || val4.inShipPhase || !Object.op_Implicit((Object)(object)val4.currentLevel) || val4.currentLevel.sceneName == "CompanyBuilding" || !val4.currentLevel.planetHasTime || !Ready()) { return; } bool flag = false; PlayerControllerB[] allPlayerScripts = val4.allPlayerScripts; foreach (PlayerControllerB val5 in allPlayerScripts) { if (!Object.op_Implicit((Object)(object)val5) || !val5.isPlayerControlled || val5.isPlayerDead) { continue; } string text = Key(val5); if (text != null) { Account account = AccountFor(text); int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; if (account.LastParticipation != timesFulfilledQuota) { account.LastParticipation = timesFulfilledQuota; flag = true; } } } if (flag) { ES3.Save("Saltanis.PersonalWallet.v1", JsonConvert.SerializeObject((object)ledger, JsonSettings), slot); } } private void Forget(ulong client) { identities.Remove(client); } private void Identity(ulong sender, FastBufferReader reader) { if (network.IsServer && network.ConnectedClients.ContainsKey(sender) && !identities.ContainsKey(sender) && ((FastBufferReader)(ref reader)).Length >= 4 && ((FastBufferReader)(ref reader)).Length <= 136) { string input = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref input, false); if (Guid.TryParseExact(input, "N", out var result) && !identities.ContainsValue(result.ToString("N"))) { identities[sender] = result.ToString("N"); } } } public static string Key(PlayerControllerB p) { if (!Object.op_Implicit((Object)(object)p)) { return null; } if (p.playerSteamId != 0L) { return "steam:" + p.playerSteamId; } if (!Object.op_Implicit((Object)(object)instance) || !instance.identities.TryGetValue(p.actualClientId, out var value)) { return null; } return "lan:" + value; } private bool Ready() { GameNetworkManager val = GameNetworkManager.Instance; StartOfRound val2 = StartOfRound.Instance; if (!Object.op_Implicit((Object)(object)network) || !network.IsServer || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || val2.isChallengeFile || !Object.op_Implicit((Object)(object)TimeOfDay.Instance) || string.IsNullOrEmpty(val.currentSaveFileName)) { return false; } if (slot == val.currentSaveFileName) { return this.ledger != null; } slot = val.currentSaveFileName; this.ledger = null; try { string text = ES3.Load("Saltanis.PersonalWallet.v1", slot, (string)null); string text2 = text ?? ES3.Load("saltanis.zabkowysklep.campaign.v1", slot, (string)null); Ledger ledger = ((text2 == null) ? new Ledger() : JsonConvert.DeserializeObject(text2, JsonSettings)); if (ledger?.Wallets == null || ledger.Wallets.Any((Account a) => a == null || string.IsNullOrEmpty(a.Player) || a.Balance < 0) || (from a in ledger.Wallets group a by a.Player).Any((IGrouping g) => g.Count() != 1)) { throw new FormatException("Invalid wallet data"); } if (text == null && text2 != null) { ES3.Save("Saltanis.PersonalWallet.v1", JsonConvert.SerializeObject((object)ledger, JsonSettings), slot); } this.ledger = ledger; } catch (Exception ex) { Debug.LogError((object)("[Saltanis Wallet] " + ex)); } return this.ledger != null; } private Account AccountFor(string key) { Account account = ledger.Wallets.Find((Account x) => x.Player == key); if (account == null) { account = new Account { Player = key }; ledger.Wallets.Add(account); } return account; } public static long Balance(PlayerControllerB p) { string key = Key(p); if (key == null || !instance.Ready()) { return 0L; } return instance.ledger.Wallets.Find((Account a) => a.Player == key)?.Balance ?? 0; } public static string[] ParticipatingAccounts(int cycle) { if (!IsActive) { return Array.Empty(); } return (from a in instance.ledger.Wallets where a.LastParticipation == cycle select a.Player).ToArray(); } public static bool TryGrantBatch(string receipt, string[] players, long cents, string moduleSaveKey, string moduleJson) { if (string.IsNullOrEmpty(receipt) || receipt.Length > 200 || players == null || players.Length > 256 || cents <= 0 || cents > 100000000 || string.IsNullOrEmpty(moduleSaveKey) || moduleSaveKey == "Saltanis.PersonalWallet.v1" || string.IsNullOrEmpty(moduleJson) || !IsActive) { return false; } string[] array = players.Distinct().ToArray(); if (array.Length == 0 || array.Any((string k) => string.IsNullOrEmpty(k) || k.Length > 150)) { return false; } Ledger ledger = instance.ledger; if (ledger.RewardReceipts == null) { ledger.RewardReceipts = new List(); } if (ledger.RewardReceipts.Contains(receipt)) { try { CommitPurchase(instance.slot, JsonConvert.SerializeObject((object)ledger, JsonSettings), moduleSaveKey, moduleJson); return true; } catch (Exception ex) { Debug.LogError((object)("[Saltanis Wallet] " + ex)); return false; } } Account[] array2 = array.Select(instance.AccountFor).ToArray(); if (array2.Any((Account a) => a.Balance > long.MaxValue - cents)) { return false; } Account[] array3 = array2; for (int num = 0; num < array3.Length; num++) { array3[num].Balance += cents; } ledger.RewardReceipts.Add(receipt); try { CommitPurchase(instance.slot, JsonConvert.SerializeObject((object)ledger, JsonSettings), moduleSaveKey, moduleJson); } catch (Exception ex2) { array3 = array2; for (int num = 0; num < array3.Length; num++) { array3[num].Balance -= cents; } ledger.RewardReceipts.Remove(receipt); Debug.LogError((object)("[Saltanis Wallet] " + ex2)); return false; } Delegate[] array4 = CrewWallet.Paid?.GetInvocationList(); if (array4 != null) { string[] array5 = array; foreach (string arg in array5) { Delegate[] array6 = array4; for (int num2 = 0; num2 < array6.Length; num2++) { Action action = (Action)array6[num2]; try { action(arg, cents); } catch (Exception ex3) { Debug.LogError((object)("[Saltanis Wallet] " + ex3)); } } } } return true; } public static bool TryPurchase(PlayerControllerB player, long cents, string moduleSaveKey, string moduleJson) { string text = Key(player); if (text == null || cents <= 0 || string.IsNullOrEmpty(moduleSaveKey) || moduleSaveKey == "Saltanis.PersonalWallet.v1" || string.IsNullOrEmpty(moduleJson) || !instance.Ready()) { return false; } Account account = instance.AccountFor(text); if (account.Balance < cents) { return false; } account.Balance -= cents; try { CommitPurchase(instance.slot, JsonConvert.SerializeObject((object)instance.ledger, JsonSettings), moduleSaveKey, moduleJson); return true; } catch (Exception ex) { account.Balance += cents; Debug.LogError((object)("[Saltanis Wallet] " + ex)); return false; } } private static void CommitPurchase(string path, string walletJson, string moduleKey, string moduleJson) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown ES3File value = null; bool flag = ES3File.cachedFiles != null && ES3File.cachedFiles.TryGetValue(path, out value); if (!flag) { value = new ES3File(path); } string text = (flag ? value.Load("Saltanis.PersonalWallet.v1", (string)null) : null); string text2 = (flag ? value.Load(moduleKey, (string)null) : null); try { value.Save("Saltanis.PersonalWallet.v1", walletJson); value.Save(moduleKey, moduleJson); value.Sync(new ES3Settings(path, (ES3Settings)null) { location = (Location)0 }); } catch { if (flag) { if (text == null) { value.DeleteKey("Saltanis.PersonalWallet.v1"); } else { value.Save("Saltanis.PersonalWallet.v1", text); } if (text2 == null) { value.DeleteKey(moduleKey); } else { value.Save(moduleKey, text2); } } throw; } } [HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")] [HarmonyPostfix] private static void Reset() { GameNetworkManager val = GameNetworkManager.Instance; if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)NetworkManager.Singleton) && NetworkManager.Singleton.IsServer && Object.op_Implicit((Object)(object)val) && !string.IsNullOrEmpty(val.currentSaveFileName) && Object.op_Implicit((Object)(object)StartOfRound.Instance) && !StartOfRound.Instance.isChallengeFile) { ES3.Save("Saltanis.PersonalWallet.v1", JsonConvert.SerializeObject((object)new Ledger(), JsonSettings), val.currentSaveFileName); instance.slot = null; instance.ledger = null; } } private static int Supplemental(DepositItemsDesk desk) { return SupplementalSaleValue?.Invoke(desk) ?? 0; } internal static void Sale(int credits, int supplemental) { if (!Object.op_Implicit((Object)(object)instance) || credits <= 0 || !instance.Ready() || StartOfRound.Instance.currentLevel?.sceneName != "CompanyBuilding") { return; } int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; Dictionary dictionary = new Dictionary(); foreach (Account wallet in instance.ledger.Wallets) { if (wallet.LastParticipation == timesFulfilledQuota) { dictionary[wallet.Player] = 5L * (long)credits; } } long num = 5L * (long)Mathf.Clamp((int)((float)supplemental * StartOfRound.Instance.companyBuyingRate), 0, credits); if (num > 0) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (Object.op_Implicit((Object)(object)val) && (val.isPlayerControlled || val.isPlayerDead) && instance.network.ConnectedClients.ContainsKey(val.actualClientId)) { string text = Key(val); if (text != null && !dictionary.ContainsKey(text)) { dictionary[text] = num; } } } } if (dictionary.Count == 0) { return; } foreach (KeyValuePair item in dictionary) { instance.AccountFor(item.Key).Balance += item.Value; } try { ES3.Save("Saltanis.PersonalWallet.v1", JsonConvert.SerializeObject((object)instance.ledger, JsonSettings), instance.slot); } catch (Exception ex) { foreach (KeyValuePair item2 in dictionary) { instance.AccountFor(item2.Key).Balance -= item2.Value; } Debug.LogError((object)("[Saltanis Wallet] Could not save sale payout: " + ex)); return; } foreach (KeyValuePair item3 in dictionary) { CrewWallet.Paid?.Invoke(item3.Key, item3.Value); } } [HarmonyPatch(typeof(DepositItemsDesk), "SellItemsOnServer")] [HarmonyTranspiler] [HarmonyPriority(0)] private static IEnumerable ObserveSale(IEnumerable original, ILGenerator il) { MethodInfo display = AccessTools.Method(typeof(DepositItemsDesk), "SellAndDisplayItemProfits", (Type[])null, (Type[])null); LocalBuilder profit = il.DeclareLocal(typeof(int)); LocalBuilder newCredits = il.DeclareLocal(typeof(int)); LocalBuilder extra = il.DeclareLocal(typeof(int)); foreach (CodeInstruction op in original) { if (!CodeInstructionExtensions.Calls(op, display)) { yield return op; continue; } yield return CodeInstructionExtensions.MoveBlocksFrom(CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Stloc, (object)newCredits), op), op); yield return new CodeInstruction(OpCodes.Dup, (object)null); yield return new CodeInstruction(OpCodes.Stloc, (object)profit); yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CrewWallet), "Supplemental", (Type[])null, (Type[])null)); yield return new CodeInstruction(OpCodes.Stloc, (object)extra); yield return new CodeInstruction(OpCodes.Ldloc, (object)newCredits); yield return op; yield return new CodeInstruction(OpCodes.Ldloc, (object)profit); yield return new CodeInstruction(OpCodes.Ldloc, (object)extra); yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CrewWallet), "Sale", (Type[])null, (Type[])null)); } } } public sealed class WalletHud { private readonly Func format; private readonly Func receiptFormat; private static readonly string[] WalletPixels = new string[16] { "................", "....#######.....", "...#.......#....", "..#.........#...", ".#############..", ".#...........#..", ".#...........#..", ".#.......######.", ".#......##....#.", ".#......#..##.#.", ".#......##....#.", ".#.......######.", ".#...........#..", ".#...........#..", ".#############..", "................" }; private RectTransform root; private TextMeshProUGUI attachedKey; private TextMeshProUGUI amount; private TextMeshProUGUI receipt; private Texture2D walletTexture; private long displayedBalance = -1L; private string payoutMessage; private float receiptUntil; public WalletHud(Func format, Func receiptFormat) { this.format = format; this.receiptFormat = receiptFormat; } public void RecordPayout(long value) { payoutMessage = string.Format(receiptFormat(), format(value)); receiptUntil = Time.unscaledTime + 6f; if (Object.op_Implicit((Object)(object)receipt)) { ((TMP_Text)receipt).text = payoutMessage; } } public void Clear() { payoutMessage = string.Empty; receiptUntil = 0f; if (Object.op_Implicit((Object)(object)root)) { ((Component)root).gameObject.SetActive(false); } } public void Dispose() { if (Object.op_Implicit((Object)(object)root)) { Object.Destroy((Object)(object)((Component)root).gameObject); } if (Object.op_Implicit((Object)(object)walletTexture)) { Object.Destroy((Object)(object)walletTexture); } } public void Update(PlayerControllerB player, long balance) { //IL_00bd: 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_00c5: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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) HUDManager instance = HUDManager.Instance; if (!Object.op_Implicit((Object)(object)player) || player.isPlayerDead || !player.isPlayerControlled || player.inTerminalMenu || !Object.op_Implicit((Object)(object)instance) || (Object.op_Implicit((Object)(object)player.quickMenuManager) && player.quickMenuManager.isMenuOpen) || !Object.op_Implicit((Object)(object)instance.utilitySlotKeyText)) { if (Object.op_Implicit((Object)(object)root)) { ((Component)root).gameObject.SetActive(false); } return; } TextMeshProUGUI utilitySlotKeyText = instance.utilitySlotKeyText; RectTransform rectTransform = ((TMP_Text)utilitySlotKeyText).rectTransform; if (!Object.op_Implicit((Object)(object)root) || (Object)(object)attachedKey != (Object)(object)utilitySlotKeyText || (Object)(object)((Transform)root).parent != (Object)(object)((Transform)rectTransform).parent) { Attach(utilitySlotKeyText); } Bounds textBounds = ((TMP_Text)utilitySlotKeyText).textBounds; bool num = ((Bounds)(ref textBounds)).size.x > 0f; Rect rect; float num2; if (!num) { rect = rectTransform.rect; num2 = ((Rect)(ref rect)).xMax; } else { num2 = ((Bounds)(ref textBounds)).max.x; } float num3 = num2; float y; if (!num) { rect = rectTransform.rect; y = ((Rect)(ref rect)).center.y; } else { y = ((Bounds)(ref textBounds)).center.y; } float num4 = y; ((Transform)root).position = ((Transform)rectTransform).TransformPoint(new Vector3(num3 + ((TMP_Text)utilitySlotKeyText).fontSize * 1.2f, num4)); ((Component)root).gameObject.SetActive(true); if (displayedBalance != balance) { displayedBalance = balance; ((TMP_Text)amount).text = format(balance); } ((Component)receipt).gameObject.SetActive(Time.unscaledTime < receiptUntil); } private void Attach(TextMeshProUGUI style) { //IL_0044: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)root)) { Object.Destroy((Object)(object)((Component)root).gameObject); } attachedKey = style; RectTransform rectTransform = ((TMP_Text)style).rectTransform; root = new GameObject("Bummer Mart wallet", new Type[1] { typeof(RectTransform) }).GetComponent(); ((Transform)root).SetParent(((Transform)rectTransform).parent, false); ((Transform)root).localRotation = ((Transform)rectTransform).localRotation; ((Transform)root).localScale = ((Transform)rectTransform).localScale; root.sizeDelta = Vector2.zero; float fontSize = ((TMP_Text)style).fontSize; float num = fontSize * 1.45f; RawImage component = new GameObject("Wallet icon", new Type[2] { typeof(RectTransform), typeof(RawImage) }).GetComponent(); component.texture = (Texture)(object)GetWalletTexture(); ((Graphic)component).color = ((Graphic)style).color; ((Graphic)component).raycastTarget = false; Layout(((Graphic)component).rectTransform, Vector2.zero, new Vector2(num, num)); float num2 = num + fontSize * 0.38f; amount = CreateText("Balance", style, new Vector2(num2, 0f), fontSize); receipt = CreateText("Payout", style, new Vector2(0f, (0f - fontSize) * 1.3f), fontSize); ((TMP_Text)receipt).fontSize = ((TMP_Text)style).fontSize * 0.82f; ((TMP_Text)receipt).text = payoutMessage; displayedBalance = -1L; } private TextMeshProUGUI CreateText(string name, TextMeshProUGUI style, Vector2 position, float unit) { //IL_0021: 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_005e: 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_0092: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI component = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }).GetComponent(); ((TMP_Text)component).font = ((TMP_Text)style).font; ((TMP_Text)component).fontSharedMaterial = ((TMP_Text)style).fontSharedMaterial; ((TMP_Text)component).fontSize = ((TMP_Text)style).fontSize; ((TMP_Text)component).fontStyle = ((TMP_Text)style).fontStyle; ((Graphic)component).color = ((Graphic)style).color; ((TMP_Text)component).alignment = (TextAlignmentOptions)4097; ((Graphic)component).raycastTarget = false; Layout(((TMP_Text)component).rectTransform, position, new Vector2(unit * 17f, unit * 1.45f)); return component; } private void Layout(RectTransform element, Vector2 position, Vector2 size) { //IL_0020: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) ((Transform)element).SetParent((Transform)(object)root, false); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); element.anchorMax = val; element.anchorMin = val; element.pivot = new Vector2(0f, 0.5f); element.anchoredPosition = position; element.sizeDelta = size; } private Texture2D GetWalletTexture() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0097: Expected O, but got Unknown //IL_0056: 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) if (Object.op_Implicit((Object)(object)walletTexture)) { return walletTexture; } int num = WalletPixels.Length; Color32[] array = (Color32[])(object)new Color32[num * num]; Color32 val = Color32.op_Implicit(Color.white); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { if (WalletPixels[i][j] == '#') { array[(num - 1 - i) * num + j] = val; } } } walletTexture = new Texture2D(num, num, (TextureFormat)4, false) { name = "Bummer Mart wallet icon", filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; walletTexture.SetPixels32(array); walletTexture.Apply(false, true); return walletTexture; } } }