//called by button event public void Sell() { for (int i = 0; i < _inventoryElement.Size; ++i) { InventorySlot slot = _inventoryElement.Slot(i); if (slot._stack._nbItem != 0 && slot._stack._item.IsSalable) { slot._stack._nbItem = 0; slot.UpdateSlot(); } } _inventoryController.Money = _inventoryController.Money + CurrentPrice; UpdatePrice(); }
/// <summary> /// Remove item from the slot selectionned in the bar. Update the ui. /!\ doesn't test if there is an item in the slot selected. /// </summary> /// <param name="nbItem">nbItem to be removed</param> public Item RemoveItemFromBarSelected(int nbItem) { _bar.Slot(_idSelected).RemoveItemFromSlot(nbItem); return(itemDatabase.GetItemByID(_bar.Slot(_idSelected)._stack._item.ID)); }