示例#1
0
        private void SetItemsUi()
        {
            IItemIterator iterator = _inventory.GetIterator();

            for (iterator.First(); iterator.IsDone(); iterator.Next())
            {
                _inventoryUi.SetItem(iterator.CurrentItem().GetItemUi(), iterator.CurrentItem().GetIdentifier());
            }
        }
示例#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());
            }
        }
        private int CalculateItemTypeCount(IItemIterator iterator, string itemType)
        {
            int count = 0;

            for (iterator.First(); !iterator.IsDone(); iterator.Next())
            {
                if (iterator.CurrentItem().GetItemType() == itemType)
                {
                    ++count;
                }
            }

            return(count);
        }