Beispiel #1
0
    public void TryTransferItemToOtherShop(ItemScript item)
    {
        //gold -= item.price;
        //otherShop.gold += item.price;

        AddItem(item, otherShop);
        RemoveItem(item, this);

        RefreshDisplay();
        otherShop.RefreshDisplay();
    }
Beispiel #2
0
    public void AddItemsToInventory()
    {
        if (userInventoryItems.gold >= shopTradeItems.itemValue - userTradeItems.itemValue && shopInventoryItems.gold >= userTradeItems.itemValue - shopTradeItems.itemValue)
        {
            userInventoryItems.gold += userTradeItems.itemValue - shopTradeItems.itemValue;
            shopInventoryItems.gold += shopTradeItems.itemValue - userTradeItems.itemValue;

            userInventoryItems.AddItems(userTradeItems, shopInventoryItems);
            userInventoryItems.AddItems(shopTradeItems, userInventoryItems);
            userTradeItems.RemoveItems(shopTradeItems);
            shopTradeItems.RemoveItems(userTradeItems);

            shopInventoryItems.RefreshDisplay();
            userInventoryItems.RefreshDisplay();
            shopTradeItems.RefreshDisplay();
            userTradeItems.RefreshDisplay();
        }
    }
Beispiel #3
0
    public void Sell()
    {
        scrollList.otherShop.itemList.Add(new ItemScript(item.itemName, sellAmountSlider.value, item.price));
        item.amount = item.amount - sellAmountSlider.value;

        sellAmountPanel.SetActive(false);

        contentPanel = transform.parent;

        for (int i = 0; i < contentPanel.childCount; i++)
        {
            if (scrollList.itemList[i].itemName != item.itemName)
            {
                contentPanel.GetChild(i).gameObject.GetComponent <Button>().interactable = true;
            }
        }

        scrollList.RefreshDisplay();
        scrollList.otherShop.RefreshDisplay();
    }