예제 #1
0
    // Use this for initialization
    protected override void Start()
    {
                #if UNITY_ANDROID_CAFE
        if (iabCafebazaar == null)
        {
            iabCafebazaar            = this;
            preventOnDestroyShutDown = false;            //must shut down in app exit
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            /**
             * some drag and drop initialize in older object that need new object in current
             */
            ((AbstractBillingSystem)iabCafebazaar).consumeLoadingBar = consumeLoadingBar;

            preventOnDestroyShutDown = true;            //must not shut down service in copy object
            Destroy(gameObject);
            return;
        }

        base.Start();

        BazaarIAB.enableLogging(false);        //this is hard coded for debug log in service
        BazaarIAB.init(encode64BasePublicKey);
        Debug.Log("cafebazaar: Billing Initialize......");
                #endif

        setBillingProgress(BillingProgress.WAIT);
        StartCoroutine(WaitForResponse());
    }
    private void Start()
    {
        IABEventManager.purchaseSucceededEvent += OnPurchased;
        IABEventManager.billingSupportedEvent  += Support;
        ZarinpalStore.OnPurchaseDone           += s => { OnPurchase(s, false); };

        DontDestroyOnLoad(gameObject);
        BazaarIAB.init(key);
        BazaarIAB.enableLogging(true);
    }
예제 #3
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(10f, 10f, Screen.width - 15f, Screen.height - 15f));
        GUI.skin.button.fixedHeight = 50;
        GUI.skin.button.fontSize    = 20;

        if (Button("Initialize IAB"))
        {
            var key = "MIHNMA0GCSqGSIb3DQEBAQUAA4G7ADCBtwKBrwDN72wlPXo4pFK78rElKD+nwc9OnHHL+YYAt0o2Fm6H+7pNoOKLk/fbXrmV3jaL2cz99IClllFKEAvo6VbyRyIOD5cWpBCV+IFVobCPs9dtCV0M4DDqpVY2NUR9WownlNMwr/AwmwW750xS8BvQ9zt5+u7VEhLkAJPVxWJfr+kLHI7519s9T5eb58cdAM+bvJ1vT0pGx6te5DrV8IHUUCKpDYPy7kBfc9wdcT6EBUMCAwEAAQ==";
            BazaarIAB.init(key);
        }

        if (Button("Query Inventory"))
        {
            BazaarIAB.queryInventory(skus);
        }

        if (Button("Query SkuDetails"))
        {
            BazaarIAB.querySkuDetails(skus);
        }

        if (Button("Query Purchases"))
        {
            BazaarIAB.queryPurchases();
        }

        if (Button("Are subscriptions supported?"))
        {
            Debug.Log("subscriptions supported: " + BazaarIAB.areSubscriptionsSupported());
        }

        if (Button("Purchase Product Test1"))
        {
            BazaarIAB.purchaseProduct("com.fanafzar.bazaarplugin.test1");
        }

        if (Button("Purchase Product Test2"))
        {
            BazaarIAB.purchaseProduct("com.fanafzar.bazaarplugin.test2");
        }

        if (Button("Consume Purchase Test1"))
        {
            BazaarIAB.consumeProduct("com.fanafzar.bazaarplugin.test1");
        }

        if (Button("Consume Purchase Test2"))
        {
            BazaarIAB.consumeProduct("com.fanafzar.bazaarplugin.test2");
        }

        if (Button("Consume Multiple Purchases"))
        {
            var skus = new string[] { "com.fanafzar.bazaarplugin.test1", "com.fanafzar.bazaarplugin.test2" };
            BazaarIAB.consumeProducts(skus);
        }

        if (Button("Test Unavailable Item"))
        {
            BazaarIAB.purchaseProduct("com.fanafzar.bazaarplugin.unavailable");
        }

        if (Button("Purchase Monthly Subscription"))
        {
            BazaarIAB.purchaseProduct("com.fanafzar.bazaarplugin.monthly_subscribtion_test", "subscription payload");
        }

        if (Button("Purchase Annually Subscription"))
        {
            BazaarIAB.purchaseProduct("com.fanafzar.bazaarplugin.annually_subscribtion_test", "subscription payload");
        }

        if (Button("Enable High Details Logs"))
        {
            BazaarIAB.enableLogging(true);
        }

        GUILayout.EndArea();
    }