コード例 #1
0
    void purchaseFailedEvent(string error)
    {
        Debug.Log("purchaseFailedEvent: " + error);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error Purchasing", "Error purchasing");
    }
コード例 #2
0
    void queryInventoryFailedEvent(string error)
    {
        Debug.Log("queryInventoryFailedEvent: " + error);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: queryInventoryFailedEvent", error);
    }
コード例 #3
0
    void billingNotSupportedEvent(string error)
    {
        Debug.Log("billingNotSupportedEvent: " + error);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: billingNotSupportedEvent", error);
    }
コード例 #4
0
    public static void onVerificationError(string _ret)
    {
        Debug.Log("Verification failed: " + _ret);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: verification failed. ErrorInfo: ", _ret);
    }
コード例 #5
0
    void purchaseFailedEvent(string error)
    {
        Debug.Log("purchaseFailedEvent: " + error);
        string response = "response: ";
        int    size     = error.LastIndexOf(":") - (error.IndexOf(response) + response.Length);

        ShowMessages sm = new ShowMessages();

        switch (error.Substring(error.IndexOf(response) + response.Length, size))
        {
        case "-1005":
            sm.ShowMessageWindow("Error Purchasing", "USER HAS CANCELLED THIS PURCHASE");
            //InAppPersistenceManager.instance.ErasePurchaseInfo(ProductID);
            break;

        case "7":
            sm.ShowMessageWindow("Error Purchasing", "YOU OWN THIS OBJECT!!");
            //InAppPersistenceManager.instance.ErasePurchaseInfo(ProductID);
            break;
        }
    }
コード例 #6
0
    public static void onVerificationSucceeded(object _ret)
    {
        Dictionary <string, object> resp = (Dictionary <string, object>)_ret;

        if (resp != null && resp.ContainsKey("code"))
        {
            int code = (int)(System.Int64)resp["code"];
            switch (code)
            {
            case 0:
                Debug.Log("Verification succeeded");
                InAppPersistenceManager.instance.SetPurchaseInfo(productID, InAppPersistenceManager.InAppPersistenceState.consume_pending);
                BillingManager.instance.HandlePurchase(resp, productID);
                break;

            case -10: { // Purchase ID not matching the purchase token
                Debug.Log("Verification failed: PurchaseID incorrect. Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Purchase Id incorrect");
            }
            break;

            case -14: { // Purchase duplicated
                Debug.Log("Verification failed: PurchaseID duplicated. Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Purchase Id duplicated");
            }
            break;

            case -29: { // Purchase TOKEN not valid (doesn't match the ProductID)
                Debug.Log("Verification failed: Purchase Token incorrect. Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Purchase Token incorrect");
            }
            break;

            default: {
                // 400 -> Wrong Purchase Token
                // 404 -> Purchase Token doesn't match the ProductId
                Debug.Log("Verification failed: Generic Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Generic Purchase Error");
            }
            break;
            }
        }
    }
コード例 #7
0
    public void init(string key, string[] skus)
    {
#if UNITY_ANDROID
        GoogleIAB.init(key);
        //copiedSkus = new string[skus.Length];
        copiedSkus = skus;
        //GoogleIAB.queryInventory(skus);
#elif UNITY_IPHONE
        bool canMakePayments = StoreKitBinding.canMakePayments();
        if (canMakePayments)
        {
            StoreKitBinding.requestProductData(skus);
        }
        else
        {
            ShowMessages sm = new ShowMessages();
            sm.ShowMessageWindow("ERROR ACCESSING APPLE STORE", "You can't connect to Apple Store, network error detected");
        }
#endif
    }
コード例 #8
0
    public static void onVerificationError(string _ret)
    {
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: confirmation failed. ErrorInfo: ", _ret);
    }