public void HandleCurrencyDeltaOfCoinsMessageFromSDK(string message) { // Determine whether the request was successful VCSResponse response = JsonMapper.ToObject <VCSResponse>(message); if (response.success) { SuccessfulCurrencyResponse delta = response.transaction; if (OnDeltaOfCoinsReceived != null) { OnDeltaOfCoinsReceived(delta.DeltaOfCoins, delta.LatestTransactionId); } if (OnSuccessfulCurrencyRequestReceived != null) { OnSuccessfulCurrencyRequestReceived(delta); } } else { if (OnDeltaOfCoinsRequestFailed != null) { OnDeltaOfCoinsRequestFailed(response.error); } } }
public void OnSuccessfulCurrencyResponseReceived(SuccessfulCurrencyResponse response) { // // CurrencyId: ID of the Virtual Currency defined in the Fyber Dashboard // This example assumes the ID is identical to the Virtual Item ID // defined in your Store Assets Implementation // DeltaOfCoins: Amount of VC to be given // int amount = (int) response.DeltaOfCoins; if(amount > 0) { StoreInventory.GiveItem(response.CurrencyId, amount); } }
// OnSuccessfulCurrencyRequestReceived: Registered to be called upon reception of the answer for a successful delta of coins request public void OnSuccessfulCurrencyRequestReceived(SuccessfulCurrencyResponse response) { coinsLabel = "Delta of coins: " + response.DeltaOfCoins.ToString() + ". Transaction ID: " + response.LatestTransactionId + ".\nCurreny ID: " + response.CurrencyId + ". Currency Name: " + response.CurrencyName; }