This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<cross-domain-policy> | |
<allow-access-from domain="*"/> | |
</cross-domain-policy> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerator ProcessRequests() | |
{ | |
if(isProcessing || taskQueue.Count == 0){ | |
yield break; | |
} | |
isProcessing = true; | |
//get a temp variable, otherwise we could be stuck in an infinite-loop (offline scenario) | |
int itemsToProcess = taskQueue.Count; | |
while(itemsToProcess > 0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Update() | |
{ | |
//the http worker has a method which returns (dequeues) | |
//an IEnumerable set of completed requests, | |
//internall it is enqueueing the completed requests | |
foreach(ApiResponse response in httpWorker.GetCompletedResponses()) | |
{ | |
if(response.Request.RequestCompleteHandler != null) | |
{ | |
//we want to notify an object that we have completed the request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace PlaynomicsPlugin | |
{ | |
internal class ConcurrentQueue<T>{ | |
private readonly object syncLock = new object(); | |
private Queue<T> queue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(taskQueue.Count > 0) | |
{ | |
WebRequest httpRequest = null; | |
HttpWebResponse response = null; | |
Stream stream = null; | |
bool requestSucceeded = false; | |
var request = taskQueue.Dequeue(); | |
request.Attempts ++; | |
try{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnUSDCurrencyExchange(long? transactionId, double usDollars, string purchasedCurrencyType, double amountPurchased){ | |
if(!transactionId.HasValue){ | |
//transactionId has no value so generate one | |
transactionId = GetRandomLong(); | |
} | |
var currencies = new TransactionCurrency[2]; | |
currencies[0] = TransactionCurrency.createReal(Math.Abs(usDollars) * -1, CurrencyType.USD); | |
currencies[1] = TransactionCurrency.createVirtual(Math.Abs(amountPurchased), purchasedCurrencyType); | |
Playnomics.instance.transaction(transactionId, TransactionType.CurrencyConvert, currencies, null, null, null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using PlaynomicsPlugin; | |
using UntiyEngine; | |
public class Scene : MonoBehavior { | |
private MessagingFrame frame; | |
private bool shown; | |
private void Awake(){ | |
MessagingFrame frame = Playnomics.instance.initMessagingFrame(<PLAYNOMICS-FRAME-ID>); | |
//enabled code callbacks, eg PNA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PlaynomicsPlugin; | |
function Start () { | |
Playnomics.instance.startPlaynomics(1234567890123456789L); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using PlaynomicsPlugin; | |
public class FirstScene : MonoBehaviour | |
{ | |
void Start() { | |
Playnomics.instance.start(1234567890123456789L, "Z6q3UAtVwcxw35p9y"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Playnomics.instance.startPlaynomics(<APPLICATION-ID>, <USERT-ID>); | |
Playnomics.instance.startPlaynomics(<APPLICATION-ID>); |