private void LoadUsableItemOffers() { _offers = new List <ServiceUsableItemOffer>(_usableItems.Count); foreach (var item in _usableItems) { ServiceUsableItemOffer uio = Instantiate(_usableItemOfferPrefab, _shopLayout); int playerAmount = 0; UsableItemTable.Element elem = _playerUsableItems.FirstOrDefault(x => x.Item.Id == item.Id); if (elem != null) { playerAmount = elem.Amount; } uio.Initialize(this, item, playerAmount); _offers.Add(uio); } }
public void Initialize(UsableItemTable.Element element) { _element = element; _icon.sprite = _element.Item.Sprite; _amount.text = _element.Amount.ToString(); }