Exemplo n.º 1
0
 public Inventory(IItemsRepositoryStrategy itemsRepositoryStrategy, IInventoryUi inventoryUi, int capacity)
 {
     _itemsRepository   = itemsRepositoryStrategy;
     _inventorySize     = 0;
     _inventoryCapacity = capacity;
     _inventoryUi       = inventoryUi;
     _inventoryUi.SetInventory(this);
 }
Exemplo n.º 2
0
        public void SetInventoryUi(IInventoryUi inventoryUi)
        {
            _inventoryUi = inventoryUi;
            _inventoryUi.SetInventory(this);
            IItemIterator itemIterator = _itemsRepository.GetIterator();

            for (itemIterator.First(); itemIterator.IsDone(); itemIterator.Next())
            {
                _inventoryUi.SetItem(itemIterator.CurrentItem().GetItemUi(), itemIterator.CurrentItem().GetIdentifier());
            }
        }