Exemple #1
0
 public void Dispose()
 {
     WriteLog("unbinding...");
     OpenIAB.unbindService();
 }
Exemple #2
0
 /// <summary>
 /// unbind from billing service.
 /// Good practice, but isn't really necessary
 /// </summary>
 public static void Terminate()
 {
     OpenIAB.unbindService();
 }
 void OnDestroy()
 {
     OpenIAB.unbindService();
     Destroy(openIABObject);
 }
Exemple #4
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();
        }
    }