Skip to main content

Register Currency

Registers player's currency.

Call Information

public void Put (List<ItemModel> items, PlayNANOODelegate callback) {}

Call Information Details

ParameterDescriptionType
itemsCurrency informationList<ItemModel>
callbackCommunication resultPlayNANOODelegate

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 KeyDescriptionType
items.currency_codeCurrency codestring
items.currency_amountAmount owneddouble