Use Item
Consumes an item stored in the player's inbox.
Call Information
// 하나의 아이템 사용
public void ConsumeItem (string itemKey, PlayNANOODelegate callback) {}
// 여러개의 아이템 사용
public void ConsumeMultiItem (List<string> itemKeys, PlayNANOODelegate callback) {}
Call Details
| Parameter | Description | Type |
|---|---|---|
| itemKey | Item identifier key | string |
| itemKeys | Item identifier key list | List<string> |
| callback | Communication result | PlayNANOODelegate |
Source Code
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
// 하나의 아이템 사용
string itemKey = "ITEM_KEY";
plugin.InboxManager.ConsumeItem(itemKey, (status, error, jsonString, values) =>
{
if(status.Equals(Configure.PN_API_STATE_SUCCESS)) {
PlayNANOO.Inbox.ItemValueModel[] items = values["Items"] as PlayNANOO.Inbox.ItemValueModel[];
foreach (PlayNANOO.Inbox.ItemValueModel item in items)
{
Debug.Log(item.item_code);
Debug.Log(item.item_count);
}
} else {
Debug.Log("Fail");
}
});
// 여러개의 아이템 사용
List<string> itemKeys = new List<string>();
itemKeys.Add("ITEM_KEY_1");
itemKeys.Add("ITEM_KEY_2");
plugin.InboxManager.ConsumeMultiItem(itemKeys, (status, error, jsonString, values) =>
{
PlayNANOO.Inbox.ItemValueModel[] items = values["Items"] as PlayNANOO.Inbox.ItemValueModel[];
foreach (PlayNANOO.Inbox.ItemValueModel item in items)
{
Debug.Log(item.item_code);
Debug.Log(item.item_count);
}
});
}
}
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"items": [
{
"item_code": "gold",
"item_count": 100
}
]
]
}
Response Details
| Data Key | Description | Type |
|---|---|---|
| items.item_code | Item code | string |
| items.item_count | Item quantity | integer |