public void DeleteItem(ItemData item) { if (DataMart.CheckItemDataBase(item.ID)) { DataMart.RemoveItem(item); ClearItemUI(); } else { Debug.LogError("Delete Error: No item with that ID"); } }
public void SaveItem(ItemData itemData) { //Set Item Name itemData.Name = NameField.text; //Set Item Description itemData.Description = DescriptionField.text; //Set Item Value itemData.Value = int.Parse(ValueField.text); //Set Item Sprite URI itemData.SpriteURI = SpriteURIField.text; switch (TypeField.value) { case 0: itemData.Type = ItemData.ItemType.Valuable; break; case 1: itemData.Type = ItemData.ItemType.Quest; break; case 2: itemData.Type = ItemData.ItemType.KeyItem; break; default: Debug.LogError("Unknown Item Type."); break; } if (DataMart.CheckItemDataBase(itemData.ID)) { DataMart.RemoveItem(itemData); } DataMart.AddItem(itemData); SaveButton.GetComponent <Image>().color = Color.green; }