示例#1
0
    public void OnPurchaseSucceeded(PurchaseContainer purchases)
    {
        PaymentManager.MyDebug.PushMessage(nameof(OnPurchaseSucceeded));
        if (((Allocator <MetaPurchase, Purchase>)purchases).get_Length() > 0)
        {
            if (((string)((Allocator <MetaPurchase, Purchase>)purchases).get_Item(0).productId).Contains("bundle"))
            {
                GlobalVars.SelectedPurchaseType = GlobalVars.PurchaseType.Bundles;
                Debug.Log((object)(">>>> Bundle purchase succeeded : " + (object)purchases));
            }
            else
            {
                GlobalVars.SelectedPurchaseType = GlobalVars.PurchaseType.Gems;
                Debug.Log((object)(">>>> Gem purchase succeeded : " + (object)purchases));
            }
        }
        else
        {
            Debug.Log((object)">>>> [ERROR] Purchase succeeded but couldn't find purchase IDs.");
        }
        this.purchaseContainerTemp = purchases;
        List <gu3.Payment.Product> productList = new List <gu3.Payment.Product>();

        if (GlobalVars.SelectedPurchaseType == GlobalVars.PurchaseType.Bundles)
        {
            using (Dictionary <string, gu3.Payment.Product> .ValueCollection.Enumerator enumerator = this.BundleOnStores.Values.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    gu3.Payment.Product current = enumerator.Current;
                    productList.Add(current);
                }
            }
            this.purchaseResult = PaymentManager.ERequestPurchaseResult.SUCCESS;
            Client.SendVerify(PaymentManager.BundleApiPath, Network.SessionID, purchases, productList.ToArray());
        }
        else
        {
            using (Dictionary <string, gu3.Payment.Product> .ValueCollection.Enumerator enumerator = this.ProductOnStores.Values.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    gu3.Payment.Product current = enumerator.Current;
                    productList.Add(current);
                }
            }
            this.purchaseResult = PaymentManager.ERequestPurchaseResult.SUCCESS;
            Client.SendVerify(PaymentManager.ApiPath, Network.SessionID, purchases, productList.ToArray());
        }
    }
示例#2
0
    public bool CheckChargeLimit(List <string> productIds)
    {
        PaymentManager.MyDebug.PushMessage(nameof(CheckChargeLimit));
        double[] numArray = new double[productIds.Count];
        string   str      = string.Empty;
        int      num      = 0;

        using (List <string> .Enumerator enumerator = productIds.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                gu3.Payment.Product productOnStore = this.ProductOnStores[enumerator.Current];
                numArray[num++] = (double)productOnStore.price;
                str             = (string)productOnStore.currency;
            }
        }
        Client.SendChargeLimit(PaymentManager.ApiPath, Network.SessionID, str, numArray);
        return(true);
    }