예제 #1
0
 public void DeleteItem(ItemData item)
 {
     if (DataMart.CheckItemDataBase(item.ID))
     {
         DataMart.RemoveItem(item);
         ClearItemUI();
     }
     else
     {
         Debug.LogError("Delete Error: No item with that ID");
     }
 }
예제 #2
0
    public void LoadItem(int id)
    {
        if (DataMart.CheckItemDataBase(id))
        {
            ItemData data = DataMart.GetItem(id);

            RefreshItemUI(data);
        }
        else
        {
            Debug.LogError("Load Error: No item with that ID");
        }
    }
예제 #3
0
    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;
    }