/* * ----------- * SELL BUTTON * ----------- */ public void Sell_Button() { // if theres nothing in the items to sell inventory do nothing. if (buyAndSellItems.GetInventorySize() < 1) { return; } for (int i = 0; i < buyAndSellItems.GetInventorySize(); i++) { // check if the item exists ItemContainer item = buyAndSellItems.GetItemFromIndex(i); if (item != null) { // check if it actually sold. bool sold = shop.SellItem(player, item.Id, item.Value); // tell player if it didnt sell. if (!sold) { outputWarning.text += string.Format("Item: {0} couldn't be sold.\n", item.Name); } } } // clear the items to sell inventory buyAndSellItems.RemoveAll(); // clear all the inputs foreach (InputField input in inputs) { input.text = ""; } }