示例#1
0
        private void OnSkuDetailsQueryCompleted(Godot.Collections.Array arrSkuDetails)
        {
            ShowAlert(JSON.Print(arrSkuDetails));

            var skuDetails = GooglePlayBillingUtils.ConvertSkuDetailsDictionaryArray(arrSkuDetails);

            foreach (var skuDetail in skuDetails)
            {
                GD.Print($"Sku {skuDetail.Sku}");
            }
        }
示例#2
0
        private void OnGooglePlayBilling_SkuDetailsQueryCompleted(Godot.Collections.Array arrSkuDetails)
        {
            var skuDetails = GooglePlayBillingUtils.ConvertSkuDetailsDictionaryArray(arrSkuDetails);

            foreach (var sku in skuDetails)
            {
                switch (sku.Sku)
                {
                // our fake potion
                case "android.test.purchased":
                    _buyPotionButton.Text = $"Buy {sku.Price}";
                    _buyPotionButton.Show();
                    break;
                }
            }
        }
示例#3
0
        private void OnGooglePlayBilling_PurchasesUpdated(Godot.Collections.Array arrPurchases)
        {
            _panel.Show();
            _processLabel.Show();
            _thanksLabel.Hide();

            var purchases = GooglePlayBillingUtils.ConvertPurchaseDictionaryArray(arrPurchases);

            foreach (var purchase in purchases)
            {
                _purchases.Add(purchase.PurchaseToken, purchase.Sku);
                // We only expect this SKU
                if (purchase.Sku == "android.test.purchased")
                {
                    _googlePlayBilling.AcknowledgePurchase(purchase.PurchaseToken);
                }
            }
        }
示例#4
0
        private void OnPurchasesUpdated(Godot.Collections.Array arrPurchases)
        {
            GD.Print($"Purchases updated: {JSON.Print(arrPurchases)}");

            // See OnConnected
            var purchases = GooglePlayBillingUtils.ConvertPurchaseDictionaryArray(arrPurchases);

            foreach (var purchase in purchases)
            {
                if (!purchase.IsAcknowledged)
                {
                    GD.Print($"Purchase {purchase.Sku} has not been acknowledged. Acknowledging...");
                    _payment.AcknowledgePurchase(purchase.PurchaseToken);
                }
            }

            if (purchases.Length > 0)
            {
                _testItemPurchaseToken = purchases.Last().PurchaseToken;
            }
        }