示例#1
0
        private IEnumerator RetryPendingPurchases()
        {
            EB.Debug.Log("Retrying Amazon pending PURCHASES");
            int   retryCount  = 0;
            float waitSeconds = 1.0f;

            while (retryCount < kMaxRetryCount)
            {
                if (_config.ReceiptPersistance == null)
                {
                    EB.Debug.Log("NO RECEIPT PERSISTANCE");
                    break;
                }
                Hashtable pendingPurchases = _config.ReceiptPersistance.GetPendingPurchaseReceipts();
                if (pendingPurchases.Count <= 0)
                {
                    EB.Debug.Log("No Pending Purchases! Done!");
                    break;
                }
                Hashtable pendingPurchasesCopy = new Hashtable(pendingPurchases);
                for (IDictionaryEnumerator iter = pendingPurchasesCopy.GetEnumerator(); iter.MoveNext();)
                {
                    string receiptString = (string)iter.Key;
                    string sku           = (string)iter.Value;

                    EB.Debug.Log("Retrying Amazon pending purchase token " + receiptString + " - " + sku);

                    PurchaseResponseCallback(PurchaseResponse.CreateFromJson(receiptString));
                }
                yield return(new WaitForSeconds(waitSeconds));

                waitSeconds *= 2.0f;
                retryCount++;
            }
            EB.Debug.Log("Retrying Amazon pending PURCHASES DONE");
        }