Exemplo n.º 1
0
    public void purchaseProduct(string code, int quantity)
    {
#if PURCHASE_USE_APPLE_ITUNES_PRIME31
        StoreKitBinding.purchaseProduct(code, quantity);
#elif PURCHASE_USE_AMAZON_PRIME31
        //AmazonIAP.initiatePurchaseRequest(GamePacks.currentGameBundle + "." + code);
        AmazonIAP.initiatePurchaseRequest(code);
#elif PURCHASE_USE_GOOGLE_PLAY_PRIME31
        GoogleIAB.purchaseProduct(code);
#elif PURCHASE_USE_UNITY
        productManager.PurchaseProduct(code);
#else
        // Web/PC
        purchaseProcessCompleted = true;

        ProductNetworkRecord data =
            ProductNetworkRecord.Create(
                code,
                "Product Purchase",
                "Product purchased:" + code,
                true,
                "TODO",
                "TODO",
                code,
                1,
                ProductNetworkType.typeThirdParty,
                ProductNetworkStoreType.typeAmazon,
                ProductNetworkConsumableType.consumable);

        BroadcastProductNetworksSuccess(data);
#endif
    }
    void OnGUI()
    {
        float yPos       = 5.0f;
        float xPos       = 5.0f;
        float width      = (Screen.width >= 800 || Screen.height >= 800) ? 320 : 160;
        float height     = (Screen.width >= 800 || Screen.height >= 800) ? 80 : 40;
        float heightPlus = height + 10.0f;


        if (GUI.Button(new Rect(xPos, yPos, width, height), "Initiate Item Data Request"))
        {
            AmazonIAP.initiateItemDataRequest(new string[] { "coinpack.tier.2", "coinpack.tier.5", "coinpack.tier.10" });
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Initiate Purchase Request"))
        {
            AmazonIAP.initiatePurchaseRequest("coinpack.tier.2");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Initiate Get User ID Request"))
        {
            AmazonIAP.initiateGetUserIdRequest();
        }
    }
Exemplo n.º 3
0
    public void purchaseProduct(string code, int quantity)
    {
#if PURCHASE_USE_APPLE_ITUNES
        StoreKitBinding.purchaseProduct(code, quantity);
#elif PURCHASE_USE_AMAZON
        //AmazonIAP.initiatePurchaseRequest(GamePacks.currentGameBundle + "." + code);
        AmazonIAP.initiatePurchaseRequest(code);
#elif PURCHASE_USE_GOOGLE_PLAY
        GoogleIAB.purchaseProduct(code);
#else
        // Web/PC
        purchaseProcessCompleted = true;

        ProductPurchaseRecord data =
            ProductPurchaseRecord.Create(
                code,
                "Product Purchase",
                "Product purchased:" + code,
                true,
                "TODO",
                "TODO",
                code,
                1,
                ProductPurchaseType.typeThirdParty,
                ProductStoreType.typeAmazon);

        BroadcastProductPurchaseSuccess(data);
#endif
    }