Register Currency
Registers player's currency.
Call Information
public void Put (List<ItemModel> items, PlayNANOODelegate callback) {}
Call Information Details
Parameter | Description | Type |
---|---|---|
items | Currency information | List<ItemModel> |
callback | Communication result | PlayNANOODelegate |
Source Code
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
List<PlayNANOO.Currency.ItemModel> currencyItems = new List<PlayNANOO.Currency.ItemModel>();
currencyItems.Add(new PlayNANOO.Currency.ItemModel { currency_code = "CURRENCY_CODE", currency_amount = 100 });
currencyItems.Add(new PlayNANOO.Currency.ItemModel { currency_code = "CURRENCY_CODE", currency_amount = 100 });
plugin.CurrencyManager.Put(currencyItems, (status, errorMessage, jsonString, values) => {
if (status.Equals(Configure.PN_API_STATE_SUCCESS))
{
PlayNANOO.Currency.ItemModel[] items = values["Items"] as PlayNANOO.Currency.ItemModel[];
foreach (PlayNANOO.Currency.ItemModel item in items)
{
Debug.Log(item.currency_code);
Debug.Log(item.currency_amount);
}
}
else
{
Debug.Log("Fail");
}
});
}
}
Communication Result
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"items": [
{
"currency_code": "GD",
"currency_amount": "1"
},
{
"currency_code": "DA",
"currency_amount": "1"
}
]
}
Communication Result Details
Data Key | Description | Type |
---|---|---|
items.currency_code | Currency code | string |
items.currency_amount | Amount owned | double |