Пример #1
0
    //--------------------------------------
    // Action Handlers
    //--------------------------------------

    static void ClientPurchaseFinishedHadnler(UM_PurchaseResult result)
    {
        if (!result.product.IsConsumable && result.isSuccess)
        {
            UM_InAppPurchaseManager.SaveNonConsumableItemPurchaseInfo(result.product);
        }
    }
    private void OnRetrieveProductsFinised(BillingResult result)
    {
        AndroidInAppPurchaseManager.ActionRetrieveProducsFinished -= OnRetrieveProductsFinised;

        UM_BillingConnectionResult r = new UM_BillingConnectionResult();

        r.message   = result.Message;
        r.isSuccess = result.IsSuccess;

        _IsConnected = r.isSuccess;

        if (r.isSuccess)
        {
            foreach (UM_InAppProduct product in UltimateMobileSettings.Instance.InAppProducts)
            {
                GoogleProductTemplate tpl = AndroidInAppPurchaseManager.Client.Inventory.GetProductDetails(product.AndroidId);
                if (tpl != null)
                {
                    product.SetTemplate(tpl);
                    if (product.IsConsumable && AndroidInAppPurchaseManager.Client.Inventory.IsProductPurchased(product.AndroidId))
                    {
                        AndroidInAppPurchaseManager.Client.Consume(product.AndroidId);
                    }

                    if (!product.IsConsumable && AndroidInAppPurchaseManager.Client.Inventory.IsProductPurchased(product.AndroidId))
                    {
                        UM_InAppPurchaseManager.SaveNonConsumableItemPurchaseInfo(product);
                    }
                }
            }
        }

        SendServiceConnectedEvent(r);
    }
Пример #3
0
    //--------------------------------------
    // Event Handlers
    //--------------------------------------


    private void OnInitComplete(WP8_InAppsInitResult result)
    {
        _IsConnected = true;

        UM_BillingConnectionResult r = new UM_BillingConnectionResult();

        r.message   = "Inited";
        r.isSuccess = true;


        foreach (UM_InAppProduct product in UltimateMobileSettings.Instance.InAppProducts)
        {
            WP8ProductTemplate tpl = WP8InAppPurchasesManager.Instance.GetProductById(product.WP8Id);
            if (tpl != null)
            {
                product.SetTemplate(tpl);
                if (product.WP8Template.IsPurchased && !product.IsConsumable)
                {
                    UM_InAppPurchaseManager.SaveNonConsumableItemPurchaseInfo(product);
                }
            }
        }

        SendServiceConnectedEvent(r);
    }