아이템 사용
플레이어 우편함에 보관 중인 아이템을 사용 처리 합니다.
호출 정보
// 하나의 아이템 사용
public void ConsumeItem (string itemKey, PlayNANOODelegate callback) {}
// 여러개의 아이템 사용
public void ConsumeMultiItem (List<string> itemKeys, PlayNANOODelegate callback) {}
호출 상세 정보
파라미터 | 설명 | 타입 |
---|---|---|
itemKey | 아이템 식별키 | string |
itemKeys | 아이템 식별키 목록 | List<string> |
callback | 통신 결과 | PlayNANOODelegate |
소스 코드
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);
}
});
}
}
통신 결과
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"items": [
{
"item_code": "gold",
"item_count": 100
}
]
]
}
통신 결과 상세 정보
데이터키 | 설명 | 타입 |
---|---|---|
items.item_code | 아이템 코드 | string |
items.item_count | 아이템 수량 | integer |