Exemple #1
0
    private void queryInventorySucceededEvent(Inventory inventory)
    {
        Debug.Log("queryInventorySucceededEvent: " + inventory);
        if (inventory != null)
        {
            _label = inventory.ToString();
        }
        Purchase fullVersionPurchase   = inventory.GetPurchase(SKU);
        bool     subscribedFullVersion = (fullVersionPurchase != null && VerifyDeveloperPayload(fullVersionPurchase.DeveloperPayload));

        Debug.Log("User " + (subscribedFullVersion ? "HAS" : "DOES NOT HAVE") + " FULL VERSION.");

        if (subscribedFullVersion)
        {
            PlayerPrefs.SetInt("p1a5I8d", 951402483);
        }
        else if (!subscribedFullVersion && query)
        {
            query = false;
            PlayerPrefs.SetInt("p1a5I8d", 0);
        }
        else if (!subscribedFullVersion && !query)
        {
            PlayerPrefs.SetInt("p1a5I8d", 0);
            OpenIAB.purchaseProduct("missileman.paid");
        }
    }
Exemple #2
0
 private void ShowBuyButton(string title, string sku, string payload, ref int offset, bool isSubscription = false)
 {
     if (_processingPayment)
     {
         GUI.Box(new Rect(Screen.width / 2 - BUTTON_WIDTH / 2, offset, BUTTON_WIDTH, BUTTON_HEIGHT), title);
     }
     else
     {
         if (GUI.Button(new Rect(Screen.width / 2 - BUTTON_WIDTH / 2, offset, BUTTON_WIDTH, BUTTON_HEIGHT), title))
         {
             _processingPayment = true;
             if (isSubscription)
             {
                 if (!OpenIAB.areSubscriptionsSupported())
                 {
                     Debug.LogError("Subscriptions are not supported. Sorry!");
                 }
                 else
                 {
                     OpenIAB.purchaseSubscription(sku, payload);
                 }
             }
             else
             {
                 OpenIAB.purchaseProduct(sku, payload);
             }
         }
     }
     offset += OFFSET + BUTTON_HEIGHT;
 }
Exemple #3
0
    public void Buy()
    {
#if UNITY_ANDROID
        OpenIAB.purchaseProduct(ItemPurchaseStore.AndroidStore);
#elif UNITY_IOS
        OpenIAB.purchaseProduct(ItemPurchaseStore.IosStore);
#elif UNITY_WP8
        OpenIAB.purchaseProduct(ItemPurchaseStore.WpStore);
#endif
    }
Exemple #4
0
 /// <summary>
 /// purchase consumable product based on its product id.
 /// If the productId matches "restore", we restore iaps instead.
 /// Our delegates then fire the appropriate succeeded/fail event
 /// </summary>
 public static void PurchaseConsumableProduct(string productId)
 {
     if (productId == "restore")
     {
         RestoreTransactions();
     }
     else
     {
         OpenIAB.purchaseProduct(GetIAPObject(productId).GetIdentifier());
     }
 }
Exemple #5
0
        private void QueryInventorySucceededEvent(Inventory inventory)
        {
            var purchases = inventory.GetAllPurchases();

            if (purchases.Any())
            {
                WriteLog("query inventory succeeded, purchases owned: {0}", string.Join(", ", purchases.Select(i => i.Sku).ToArray()));

                if (_sku == null)
                {
                    foreach (var purchase in purchases)
                    {
                        WriteLog("restoring owned purchase: {0}", purchase.Sku);
                        Purchased(purchase);
                    }
                }
                else
                {
                    var purchase = purchases.SingleOrDefault(i => i.Sku == _sku);

                    if (purchase != null)
                    {
                        WriteLog("restoring owned purchase: {0}", purchase.Sku);
                        Purchased(purchase);
                    }
                }
            }
            else
            {
                WriteLog("query inventory succeeded, owned purchases not found");
            }


            #if UNITY_IPHONE
            if (_sku == null)
            {
                WriteLog("restoring transactions (iOS)...");
                OpenIAB.restoreTransactions();
            }
            #endif

            #if UNITY_ANDROID || UNITY_WEBPLAYER
            if (_sku == null || inventory.HasPurchase(_sku))
            {
                CompleteTask(RestoreCompleted, "purchases successfully restored (inventory check)");
            }
            #endif

            else
            {
                WriteLog("purchasing product: {0}", _sku);
                OpenIAB.purchaseProduct(_sku, Convert.ToString(CRandom.GetRandom(0, 1000000)));
            }
        }
Exemple #6
0
 //-------------------------------------------------------------------------
 public static void pay(string buy_item_sku, string charge_data, _ePayType pay_type)
 {
     if (pay_type == _ePayType.AppStore)
     {
         OpenIAB.purchaseProduct(buy_item_sku);
     }
     else
     {
         mIPay.pay(charge_data, (int)pay_type);
     }
 }
Exemple #7
0
    ////-------------------------------------------------------------------------
    //public static void payWithChargeData(string buy_item_sku, string charge_data, _ePayType pay_type)
    //{
    //    if (pay_type == _ePayType.iap)
    //    {
    //        OpenIAB.purchaseProduct(buy_item_sku);
    //    }
    //    else
    //    {
    //        mIPay.payWithChargeData(charge_data, (int)pay_type);
    //    }
    //}

    //-------------------------------------------------------------------------
    public static void pay(string buy_item_sku, string bill_title, _ePayType pay_type,
                           int bill_totalfee, string bill_num, string buy_id, string url_scheme)
    {
        if (pay_type == _ePayType.iap)
        {
            OpenIAB.purchaseProduct(buy_item_sku);
        }
        else
        {
            mIPay.pay(bill_title, (int)pay_type, bill_totalfee, bill_num, buy_id, url_scheme);
        }
    }
Exemple #8
0
//    private 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), "Initialize OpenIAB")) {
////            // Application public key
////            var public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqibEPHCtfPm3Rn26gbE6vhCc1d6A072im+oWNlkUAJYV//pt1vCkYLqkkw/P2esPSWaw1nt66650vfVYc3sYY6L782n/C+IvZWQt0EaLrqsSoNfN5VqPhPeGf3wqsOvbKw9YqZWyKL4ddZUzRUPex5xIzjHHm3qIJI5v7iFJHOxOj0bLuEG8lH0Ljt/w2bNe4o0XXoshYDqpzIKmKy6OYNQOs8iBTJlfSmPrlGudmldW6CsuAKeVGm+Z+2xx3Xxsx3eSwEgEaUc1ZsMWSGsV6dXgc3JrUvK23JRJUu8X5Ec1OQLyxL3VelD5f0iKVTJ1kw59tMAVZ7DDpzPggWpUkwIDAQAB";
////
////            var options = new Options();
////            options.verifyMode = OptionsVerifyMode.VERIFY_SKIP;
////            options.storeKeys = new Dictionary<string, string> {
////                {OpenIAB_Android.STORE_GOOGLE, public_key}
////            };
////
////            // Transmit options and start the service
////            OpenIAB.init(options);
////        }
//
//        if (!_isInitialized)
//            return;
//
//        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Purchase")) {
//            OpenIAB.purchaseProduct("android.test.purchased");
//        }
//
//        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Refund")) {
//            OpenIAB.purchaseProduct("android.test.refunded");
//        }
//
//        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Item Unavailable")) {
//            OpenIAB.purchaseProduct("android.test.item_unavailable");
//        }
//
//        xPos = Screen.width - width - 5.0f;
//        yPos = 5.0f;
//
//        if (GUI.Button(new Rect(xPos, yPos, width, height), "Test Purchase Canceled")) {
//            OpenIAB.purchaseProduct("android.test.canceled");
//        }
//
//        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Query Inventory")) {
//            OpenIAB.queryInventory(new string[] { SKU });
//        }
//
//        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Purchase Real Product")) {
//            OpenIAB.purchaseProduct(SKU);
//        }
//
//        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Consume Real Product")) {
//            OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU));
//        }
//    }
#endif

#if UNITY_WP8
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, Screen.width * 0.3f, Screen.height * 0.1f), "QUERY INVENTORY"))
        {
            OpenIAB.queryInventory(new string[] { SKU_AMMO, SKU_MEDKIT, SKU_SUBSCRIPTION });
        }
        if (GUI.Button(new Rect(20 + Screen.width * 0.3f, 10, Screen.width * 0.3f, Screen.height * 0.1f), "Purchase"))
        {
            OpenIAB.purchaseProduct(SKU_MEDKIT);
        }
        if (GUI.Button(new Rect(30 + Screen.width * 0.6f, 10, Screen.width * 0.3f, Screen.height * 0.1f), "Consume"))
        {
            OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU_MEDKIT));
        }
        GUI.Label(new Rect(10, 20 + Screen.height * 0.1f, Screen.width, Screen.height), _label);
    }
Exemple #9
0
    public bool Donate()
    {
        if (_isInitialized)
        {
            string randomString = B64X.GetNewKey() + B64X.GetNewKey();

            //real Purchase
            OpenIAB.purchaseProduct(SKU, randomString);
            //ToDo: save payload on server

            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemple #10
0
 public void buy_button(int id_button)
 {
     if (id_button == 0)
     {
         OpenIAB.purchaseProduct(SKU_money_10k);
     }
     else if (id_button == 1)
     {
         OpenIAB.purchaseProduct(SKU_money_25k);
     }
     else if (id_button == 2)
     {
         OpenIAB.purchaseProduct(SKU_money_50k);
     }
     else if (id_button == 3)
     {
         OpenIAB.purchaseProduct(SKU_money_100k);
     }
     else if (id_button == 4)
     {
         OpenIAB.purchaseProduct(SKU_money_1mln);
     }
 }
    private void OnGUI()
    {
        _column = 0;
        _row    = 0;

        GUI.skin.button.fontSize = (Screen.width >= SMALL_SCREEN_SIZE || Screen.height >= SMALL_SCREEN_SIZE) ? LARGE_FONT_SIZE : SMALL_FONT_SIZE;

        if (Button("Initialize OpenIAB"))
        {
            // Application public key
            var publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqibEPHCtfPm3Rn26gbE6vhCc1d6A072im+oWNlkUAJYV//pt1vCkYLqkkw/P2esPSWaw1nt66650vfVYc3sYY6L782n/C+IvZWQt0EaLrqsSoNfN5VqPhPeGf3wqsOvbKw9YqZWyKL4ddZUzRUPex5xIzjHHm3qIJI5v7iFJHOxOj0bLuEG8lH0Ljt/w2bNe4o0XXoshYDqpzIKmKy6OYNQOs8iBTJlfSmPrlGudmldW6CsuAKeVGm+Z+2xx3Xxsx3eSwEgEaUc1ZsMWSGsV6dXgc3JrUvK23JRJUu8X5Ec1OQLyxL3VelD5f0iKVTJ1kw59tMAVZ7DDpzPggWpUkwIDAQAB";

            var options = new Options();
            options.verifyMode = OptionsVerifyMode.VERIFY_SKIP;
            options.storeKeys  = new Dictionary <string, string> {
                { OpenIAB_Android.STORE_GOOGLE, publicKey }
            };

            // Transmit options and start the service
            OpenIAB.init(options);
        }

        if (!_isInitialized)
        {
            return;
        }

        if (Button("Query Inventory"))
        {
            OpenIAB.queryInventory(new string[] { SKU });
        }

        if (Button("Purchase Product"))
        {
            OpenIAB.purchaseProduct(SKU);
        }

        if (Button("Consume Product"))
        {
            OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU));
        }

// Android specific buttons
#if UNITY_ANDROID
        if (Button("Test Purchase"))
        {
            OpenIAB.purchaseProduct("android.test.purchased");
        }

        if (Button("Test Refund"))
        {
            OpenIAB.purchaseProduct("android.test.refunded");
        }

        if (Button("Test Item Unavailable"))
        {
            OpenIAB.purchaseProduct("android.test.item_unavailable");
        }

        if (Button("Test Purchase Canceled"))
        {
            OpenIAB.purchaseProduct("android.test.canceled");
        }
#endif
    }
Exemple #12
0
 public void Purchase()
 {
     gameManager.game2 = false;
     OpenIAB.purchaseProduct(SKU);
 }
Exemple #13
0
    void DrawShopWindow(int windowID)
    {
        // Close button
        if (GUI.Button(new Rect(WINDOW_WIDTH - 35, 5, 30, 30), "X"))
        {
            ShowShopWindow(false);
        }

        if (_processingPayment)
        {
            GUI.Box(new Rect(10, 40, WINDOW_WIDTH - 20, SIDE_BUTTON_HEIGHT), "Processing payment...");
            return;
        }

        GUI.skin.box.alignment = TextAnchor.MiddleCenter;

        // Buy Infinite Ammo subscription
        Rect rect = new Rect(10, 40, WINDOW_WIDTH - 20, SIDE_BUTTON_HEIGHT);

        if (_playerAmmoBox.IsInfinite)
        {
            GUI.Box(rect, "Infinite ammo plan active");
        }
        else if (GUI.Button(rect, "Buy infinite ammo"))
        {
            _processingPayment = true;
            OpenIAB.purchaseSubscription(SKU_INFINITE_AMMO);
        }

        // Buy Ammo
        rect = new Rect(10, SIDE_BUTTON_HEIGHT + 45, WINDOW_WIDTH - 20, SIDE_BUTTON_HEIGHT);
        if (_playerAmmoBox.IsFull)
        {
            GUI.Box(rect, "Ammo box is full");
        }
        else if (_playerAmmoBox.IsInfinite)
        {
            GUI.Box(rect, "Buy Ammo");
        }
        else if (GUI.Button(rect, string.Format("Buy Ammo ({0} rounds)", N_ROUNDS)))
        {
            _processingPayment = true;
            OpenIAB.purchaseProduct(SKU_AMMO);
        }

        // Buy MedKit
        rect = new Rect(10, SIDE_BUTTON_HEIGHT * 2 + 50, WINDOW_WIDTH - 20, SIDE_BUTTON_HEIGHT);
        if (_playerMedKitPack.IsFull)
        {
            GUI.Box(rect, "MedKit pack is full");
        }
        else if (GUI.Button(rect, "Buy MedKit"))
        {
            _processingPayment = true;
            OpenIAB.purchaseProduct(SKU_MEDKIT);
        }

        // Buy Cowboy Hat
        rect = new Rect(10, SIDE_BUTTON_HEIGHT * 3 + 55, WINDOW_WIDTH - 20, SIDE_BUTTON_HEIGHT);
        if (_playerHat.PutOn)
        {
            GUI.Box(rect, "Cowboy hat purchased");
        }
        else if (GUI.Button(rect, "Buy Cowboy Hat"))
        {
            _processingPayment = true;
            OpenIAB.purchaseProduct(SKU_COWBOY_HAT);
        }
    }
Exemple #14
0
 public void BuyCoin100k()
 {
     OpenIAB.purchaseProduct(SKU_100);
 }
Exemple #15
0
 public void Buy(string sku = SKU)
 {
     print("Buying - " + sku);
     OpenIAB.purchaseProduct(sku);
 }
Exemple #16
0
    private void OnGUI()
    {
        _column = 0;
        _row    = 0;

        GUI.skin.button.fontSize = (Screen.width >= SMALL_SCREEN_SIZE || Screen.height >= SMALL_SCREEN_SIZE) ? LARGE_FONT_SIZE : SMALL_FONT_SIZE;

        if (Button("Initialize OpenIAB"))
        {
            // Application public key
            var googlePublicKey  = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgEEaiFfxugLWAH4CQqXYttXlj3GI2ozlcnWlZDaO2VYkcUhbrAz368FMmw2g40zgIDfyopFqETXf0dMTDw7VH3JOXZID2ATtTfBXaU4hqTf2lSwcY9RXe/Uz0x1nf1oLAf85oWZ7uuXScR747ekzRZB4vb4afm2DsbE30ohZD/WzQ22xByX6583yYE19RdE9yJzFckEPlHuOeMgKOa4WErt11PHB6FTdT5eN96/jjjeEoYhX/NGkOWKW0Y0T0A7CdUC0D4t2xxkzAQHdgLfcRw9+/EIcaysLhncWYiCifJrRBGpqZU1IrNuehrC5FXUN99786c/TwlxNG5nflE6sWwIDAQAB";
            var yandexPublicKey  = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApvU8l4ONEEsSGznPN6DnjIbJnv6vEgm08nbbi+2fMc0V46N7x7jBWTWAf2K6XLZg/rLUkqbWISq12PLvt7ydcsD+Hb9ZubdN2h8LNCTohVPeDbJjd5khtF4J5FNP2/XSTc1C7cSCBTGmqH0fUr77v4x/JMpxKlSjPN6KbNnaF2BLDAdi3012lz2XX4BVgUj7LArID/vYSYGlwMzMkvhUSpvZOM/WIPN+8YDgQAFBlRGRjLhY/3Vpq/AtXtVAzzyfTOZYkwNqdXpwAq5+/51LphowUI5NEBYh8lhQeOJmPNA6EcF1h5L9cJTVLy3bkuCXcjoN2eEO1Nq0h/40G0R4pwIDAQAB";
            var slideMePublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAogOQb0mMbuq4FQ4ZhWRhN8k76/gXOUE370VubZa9Up25GdptYXoRNniecUTDLyjfvWp7+YFW8iPqIp523qNXtQ0EynNhK4xNLvJCd1CjfAju6M0f+o8MOL1zV7g3dHqxICZoHwqBbQOWneDzG/DzJ22AVdLKwty0qbv8ESaCOCJe31ZnoYVMw5KNVkSuRrrhiGGh6xj7F3qZ0T5TOSp3fK7soDamQLevuU7Ndn5IQACjo92HNN0O2PR2cvEjkCRuIkNk2hnqinac984JCzCC0SC/JBnUZUAeYJ7Y8sjT+79z1T1g7yGgDesopnqORiBkeXEZHrFy7PifdA/ZX7rRwQIDAQAB";

            var options = new Options();
            options.checkInventoryTimeoutMs = Options.INVENTORY_CHECK_TIMEOUT_MS * 2;
            options.discoveryTimeoutMs      = Options.DISCOVER_TIMEOUT_MS * 2;
            options.checkInventory          = false;
            options.verifyMode          = OptionsVerifyMode.VERIFY_SKIP;
            options.prefferedStoreNames = new string[] { OpenIAB_Android.STORE_AMAZON };
            options.availableStoreNames = new string[] { OpenIAB_Android.STORE_AMAZON };
            options.storeKeys           = new Dictionary <string, string> {
                { OpenIAB_Android.STORE_GOOGLE, googlePublicKey }
            };
            options.storeKeys = new Dictionary <string, string> {
                { OpenIAB_Android.STORE_YANDEX, yandexPublicKey }
            };
            options.storeKeys = new Dictionary <string, string> {
                { OpenIAB_Android.STORE_SLIDEME, slideMePublicKey }
            };
            options.storeSearchStrategy = SearchStrategy.INSTALLER_THEN_BEST_FIT;

            // Transmit options and start the service
            OpenIAB.init(options);
        }

        if (!_isInitialized)
        {
            return;
        }

        if (Button("Query Inventory"))
        {
            OpenIAB.queryInventory(new string[] { SKU });
        }

        if (Button("Purchase Product"))
        {
            OpenIAB.purchaseProduct(SKU);
        }

        if (Button("Consume Product"))
        {
            if (_inventory != null && _inventory.HasPurchase(SKU))
            {
                OpenIAB.consumeProduct(_inventory.GetPurchase(SKU));
            }
        }

// Android specific buttons
#if UNITY_ANDROID
        if (Button("Test Purchase"))
        {
            OpenIAB.purchaseProduct("android.test.purchased");
        }

        if (Button("Test Consume"))
        {
            if (_inventory != null && _inventory.HasPurchase("android.test.purchased"))
            {
                OpenIAB.consumeProduct(_inventory.GetPurchase("android.test.purchased"));
            }
        }

        if (Button("Test Item Unavailable"))
        {
            OpenIAB.purchaseProduct("android.test.item_unavailable");
        }

        if (Button("Test Purchase Canceled"))
        {
            OpenIAB.purchaseProduct("android.test.canceled");
        }
#endif
    }
Exemple #17
0
 public void PurchaseProduct(string good)
 {
     //Debug.Log ("SuccessFull");
     _purchaseDone = false;
     OpenIAB.purchaseProduct(good);
 }
 public void BuyItem()
 {
     OpenIAB.purchaseProduct("buyshe");
 }
Exemple #19
0
 public void buylife()
 {
     OpenIAB.purchaseProduct(SKU_Life);
 }
Exemple #20
0
    private void OnGUI()
    {
        _column = 0;
        _row    = 0;

        GUI.skin.button.fontSize = (Screen.width >= SMALL_SCREEN_SIZE || Screen.height >= SMALL_SCREEN_SIZE) ? LARGE_FONT_SIZE : SMALL_FONT_SIZE;

        if (Button("Initialize OpenIAB"))
        {
            // Application public key
            var publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgEEaiFfxugLWAH4CQqXYttXlj3GI2ozlcnWlZDaO2VYkcUhbrAz368FMmw2g40zgIDfyopFqETXf0dMTDw7VH3JOXZID2ATtTfBXaU4hqTf2lSwcY9RXe/Uz0x1nf1oLAf85oWZ7uuXScR747ekzRZB4vb4afm2DsbE30ohZD/WzQ22xByX6583yYE19RdE9yJzFckEPlHuOeMgKOa4WErt11PHB6FTdT5eN96/jjjeEoYhX/NGkOWKW0Y0T0A7CdUC0D4t2xxkzAQHdgLfcRw9+/EIcaysLhncWYiCifJrRBGpqZU1IrNuehrC5FXUN99786c/TwlxNG5nflE6sWwIDAQAB";

            var options = new Options();
            options.checkInventoryTimeoutMs = Options.INVENTORY_CHECK_TIMEOUT_MS * 2;
            options.discoveryTimeoutMs      = Options.DISCOVER_TIMEOUT_MS * 2;
            options.checkInventory          = false;
            options.verifyMode          = OptionsVerifyMode.VERIFY_SKIP;
            options.prefferedStoreNames = new string[] { OpenIAB_Android.STORE_GOOGLE };
            options.availableStoreNames = new string[] { OpenIAB_Android.STORE_GOOGLE };
            options.storeKeys           = new Dictionary <string, string> {
                { OpenIAB_Android.STORE_GOOGLE, publicKey }
            };
            options.storeSearchStrategy = SearchStrategy.INSTALLER_THEN_BEST_FIT;

            // Transmit options and start the service
            OpenIAB.init(options);
        }

        if (!_isInitialized)
        {
            return;
        }

        if (Button("Query Inventory"))
        {
            OpenIAB.queryInventory(new string[] { SKU });
        }

        if (Button("Purchase Product"))
        {
            OpenIAB.purchaseProduct(SKU);
        }

        if (Button("Consume Product"))
        {
            if (_inventory != null && _inventory.HasPurchase(SKU))
            {
                OpenIAB.consumeProduct(_inventory.GetPurchase(SKU));
            }
        }

// Android specific buttons
#if UNITY_ANDROID
        if (Button("Test Purchase"))
        {
            OpenIAB.purchaseProduct("android.test.purchased");
        }

        if (Button("Test Consume"))
        {
            if (_inventory != null && _inventory.HasPurchase("android.test.purchased"))
            {
                OpenIAB.consumeProduct(_inventory.GetPurchase("android.test.purchased"));
            }
        }

        if (Button("Test Item Unavailable"))
        {
            OpenIAB.purchaseProduct("android.test.item_unavailable");
        }

        if (Button("Test Purchase Canceled"))
        {
            OpenIAB.purchaseProduct("android.test.canceled");
        }
#endif
    }
Exemple #21
0
    private 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), "Initialize OpenIAB"))
        {
            // Application public key
            var public_key = "key";

            var options = new Options();
            options.verifyMode = OptionsVerifyMode.VERIFY_SKIP;
            options.storeKeys  = new Dictionary <string, string> {
                { OpenIAB_Android.STORE_GOOGLE, public_key }
            };

            // Transmit options and start the service
            OpenIAB.init(options);
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Purchase"))
        {
            OpenIAB.purchaseProduct("android.test.purchased");
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Refund"))
        {
            OpenIAB.purchaseProduct("android.test.refunded");
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Item Unavailable"))
        {
            OpenIAB.purchaseProduct("android.test.item_unavailable");
        }

        xPos = Screen.width - width - 5.0f;
        yPos = 5.0f;

        if (GUI.Button(new Rect(xPos, yPos, width, height), "Test Purchase Canceled"))
        {
            OpenIAB.purchaseProduct("android.test.canceled");
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Query Inventory"))
        {
            OpenIAB.queryInventory();
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Purchase Real Product"))
        {
            OpenIAB.purchaseProduct(SKU);
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Stop Billing Service"))
        {
            OpenIAB.unbindService();
        }
    }
Exemple #22
0
 public void ButtonBuy(Transform button)
 {
     OpenIAB.purchaseProduct(button.parent.name);
 }
Exemple #23
0
 public void BuyCoin50k()
 {
     OpenIAB.purchaseProduct(SKU_50);
 }
Exemple #24
0
 public void purchaseProduct(string good)
 {
     _purchaseDone = false;
     OpenIAB.purchaseProduct(good);
 }
Exemple #25
0
    private 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), "Initialize OpenIAB"))
        {
            // Application public key
            var public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqibEPHCtfPm3Rn26gbE6vhCc1d6A072im+oWNlkUAJYV//pt1vCkYLqkkw/P2esPSWaw1nt66650vfVYc3sYY6L782n/C+IvZWQt0EaLrqsSoNfN5VqPhPeGf3wqsOvbKw9YqZWyKL4ddZUzRUPex5xIzjHHm3qIJI5v7iFJHOxOj0bLuEG8lH0Ljt/w2bNe4o0XXoshYDqpzIKmKy6OYNQOs8iBTJlfSmPrlGudmldW6CsuAKeVGm+Z+2xx3Xxsx3eSwEgEaUc1ZsMWSGsV6dXgc3JrUvK23JRJUu8X5Ec1OQLyxL3VelD5f0iKVTJ1kw59tMAVZ7DDpzPggWpUkwIDAQAB";

            var options = new Options();
            options.verifyMode = OptionsVerifyMode.VERIFY_SKIP;
            options.storeKeys  = new Dictionary <string, string> {
                { OpenIAB_Android.STORE_GOOGLE, public_key }
            };

            // Transmit options and start the service
            OpenIAB.init(options);
        }

        if (!_isInitialized)
        {
            return;
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Purchase"))
        {
            OpenIAB.purchaseProduct("android.test.purchased");
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Refund"))
        {
            OpenIAB.purchaseProduct("android.test.refunded");
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Item Unavailable"))
        {
            OpenIAB.purchaseProduct("android.test.item_unavailable");
        }

        xPos = Screen.width - width - 5.0f;
        yPos = 5.0f;

        if (GUI.Button(new Rect(xPos, yPos, width, height), "Test Purchase Canceled"))
        {
            OpenIAB.purchaseProduct("android.test.canceled");
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Query Inventory"))
        {
            OpenIAB.queryInventory(new string[] { SKU });
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Purchase Real Product"))
        {
            OpenIAB.purchaseProduct(SKU);
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Consume Real Product"))
        {
            OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU));
        }
    }