コード例 #1
0
    void OnGUI()
    {
        return;

        if (GUILayout.Button("Get Can Make Payments"))
        {
            canMakePayments = StoreKitBinding.canMakePayments();
            Debug.Log("StoreKit canMakePayments: " + canMakePayments);
        }


        if (GUILayout.Button("Get Product Data"))
        {
            // array of product ID's from iTunesConnect.  MUST match exactly what you have there!
            var productIdentifiers = new string[] { "com.DMDEnterprise.kicktheballfree.100coins", "com.DMDEnterprise.kicktheballfree.200coins" };
            StoreKitBinding.requestProductData(productIdentifiers);
        }


        if (GUILayout.Button("Restore Completed Transactions"))
        {
            StoreKitBinding.restoreCompletedTransactions();
        }



        // enforce the fact that we can't purchase products until we retrieve the product data
        if (_products != null && _products.Count > 0)
        {
            if (GUILayout.Button("Purchase Random Product"))
            {
                var productIndex = Random.Range(0, _products.Count);
                var product      = _products[productIndex];

                Debug.Log("preparing to purchase product: " + product.productIdentifier);
                StoreKitBinding.purchaseProduct(product.productIdentifier, 1);
            }
        }


        if (GUILayout.Button("Get Saved Transactions"))
        {
            List <StoreKitTransaction> transactionList = StoreKitBinding.getAllSavedTransactions();

            // Print all the transactions to the console
            Debug.Log("\ntotal transaction received: " + transactionList.Count);

            foreach (StoreKitTransaction transaction in transactionList)
            {
                Debug.Log(transaction.ToString() + "\n");
            }
        }


        if (GUILayout.Button("Turn Off Auto Confirmation of Transactions"))
        {
            // this is used when you want to validate receipts on your own server or when dealing with iTunes hosted content
            // you must manually call StoreKitBinding.finishPendingTransactions when the download/validation is complete
            StoreKitManager.autoConfirmTransactions = false;
        }


        if (GUILayout.Button("Display App Store"))
        {
            StoreKitBinding.displayStoreWithProductId("305967442");
        }
    }
コード例 #2
0
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Get Can Make Payments"))
        {
            bool canMakePayments = StoreKitBinding.canMakePayments();
            Debug.Log("StoreKit canMakePayments: " + canMakePayments);
        }


        if (GUILayout.Button("Request Product Data"))
        {
            // array of product ID's from iTunesConnect. MUST match exactly what you have there!
            var productIdentifiers = new string[] { "anotherProduct", "tt", "testProduct", "sevenDays", "oneMonthSubsciber" };
            StoreKitBinding.requestProductData(productIdentifiers);
        }


        if (GUILayout.Button("Restore Completed Transactions"))
        {
            StoreKitBinding.restoreCompletedTransactions();
        }


        endColumn(true);


        // enforce the fact that we can't purchase products until we retrieve the product data
        if (_products != null && _products.Count > 0)
        {
            if (GUILayout.Button("Purchase Random Product"))
            {
                var productIndex = Random.Range(0, _products.Count);
                var product      = _products[productIndex];

                Debug.Log("preparing to purchase product: " + product.productIdentifier);
                StoreKitBinding.purchaseProduct(product.productIdentifier, 1);
            }
        }
        else
        {
            GUILayout.Label("Once you successfully request product data a purchase button will appear here for testing");
        }


        if (GUILayout.Button("Get Saved Transactions"))
        {
            List <StoreKitTransaction> transactionList = StoreKitBinding.getAllSavedTransactions();

            // Print all the transactions to the console
            Debug.Log("\ntotal transaction received: " + transactionList.Count);

            foreach (StoreKitTransaction transaction in transactionList)
            {
                Debug.Log(transaction.ToString() + "\n");
            }
        }


        if (GUILayout.Button("Turn Off Auto Confirmation of Transactions"))
        {
            // this is used when you want to validate receipts on your own server or when dealing with iTunes hosted content
            // you must manually call StoreKitBinding.finishPendingTransactions when the download/validation is complete
            StoreKitManager.autoConfirmTransactions = false;
        }


        if (GUILayout.Button("Cancel Downloads"))
        {
            StoreKitBinding.cancelDownloads();
        }


        if (GUILayout.Button("Display App Store"))
        {
            StoreKitBinding.displayStoreWithProductId("305967442");
        }

        endColumn();
    }
コード例 #3
0
 public void OpenOtherApp()
 {
     StoreKitBinding.displayStoreWithProductId("305967442");
 }