public Inventory.Item GetItem(int appId, long contextId, ulong id, bool isCurrency) { try { var inventory = Inventories[appId]; if (isCurrency) { Inventory.CurrencyItem currencyItem = null; if (inventory[contextId].RgCurrencies.ContainsKey(id.ToString())) { currencyItem = inventory[contextId].RgCurrencies[id.ToString()]; } var key = string.Format("{0}_{1}", currencyItem.ClassId, 0); return(inventory[contextId].RgDescriptions[key]); } else { Inventory.ItemInfo item = null; if (inventory[contextId].RgInventory.ContainsKey(id.ToString())) { item = inventory[contextId].RgInventory[id.ToString()]; } var key = string.Format("{0}_{1}", item.ClassId, item.InstanceId); return(inventory[contextId].RgDescriptions[key]); } } catch { return(null); } }
private void SetupSlot(ItemSlot slot, Inventory.ItemInfo item) { slot.Count.text = item.Count.ToString(); slot.Item = item.Item; slot.Icon.sprite = item.Item.Icon; slot.Icon.color = Color.white; slot.Slot.enabled = true; }