Exemplo n.º 1
0
    public override void Populate()
    {
        if (storeInventory == null)
        {
            return;
        }

        /* Remove all items from the catalogue */
        ClearItems();

        for (int x = 0; x < StoreInventory.MAX_ITEMS; x++)
        {
            /* Get the item from the store inventory  */
            Item item = storeInventory.GetItem(x);

            /* If this item is null, skip it */
            if (item == null)
            {
                continue;
            }

            /* Add the item to the bartering catalogue */
            AddItem(item);
        }
    }
Exemplo n.º 2
0
    private void PopulateShopSlots()
    {
        Item curItem       = currentStoreInventory.GetItem(0);
        int  curItemNumber = 0;

        if (currentStoreInventory.GetSize() > shopSlots.Count)
        {
            for (int j = 0; j < shopSlots.Count; j++)
            {
                for (int i = 0; i < currentStoreInventory.GetSize(); i++)
                {
                    if (!Item.IsNull(currentStoreInventory.GetItem(i)) && curItem.item_value > currentStoreInventory.GetItem(i).item_value)
                    {
                        curItem       = currentStoreInventory.GetItem(i);
                        curItemNumber = i;
                    }
                }
                currentStoreInventory.RemoveItem(currentStoreInventory.GetItem(curItemNumber), 1);
                shopSlots[j].DisplayItem(curItem.item_prefab);
                curItem = currentStoreInventory.GetItem(0);
            }
        }
    }