コード例 #1
0
    public void purchaseProduct(string code, int quantity)
    {
#if PURCHASE_USE_APPLE_ITUNES
        StoreKitBinding.purchaseProduct(code, quantity);
#elif PURCHASE_USE_AMAZON
        //AmazonIAP.initiatePurchaseRequest(GamePacks.currentGameBundle + "." + code);
        AmazonIAP.initiatePurchaseRequest(code);
#elif PURCHASE_USE_GOOGLE_PLAY
        GoogleIAB.purchaseProduct(code);
#else
        // Web/PC
        purchaseProcessCompleted = true;

        ProductPurchaseRecord data =
            ProductPurchaseRecord.Create(
                code,
                "Product Purchase",
                "Product purchased:" + code,
                true,
                "TODO",
                "TODO",
                code,
                1,
                ProductPurchaseType.typeThirdParty,
                ProductStoreType.typeAmazon);

        BroadcastProductPurchaseSuccess(data);
#endif
    }
コード例 #2
0
    void productListReceivedEvent(List <StoreKitProduct> productList)
    {
        Debug.Log("productListReceivedEvent. total products received: " + productList.Count);

        // print the products to the console
        foreach (StoreKitProduct product in productList)
        {
            Debug.Log(product.ToString() + "\n");
        }

        Debug.Log("total productsReceived: " + productList.Count);

        // Do something more useful with the products than printing them to the console
        foreach (StoreKitProduct product in productList)
        {
            if (product.productIdentifier == CurProduct.pid)
            {
                if (isBuying)               //;// = true;
                {
                    Debug.Log("FindProduct" + CurProduct.pid);
                    StoreKitBinding.purchaseProduct(CurProduct.pid, 1);
                    isBuying = false;
                }
                return;
            }
            Debug.Log(product.ToString() + "\n");
        }

        BuyFail(IAPHelper.FailType.PRODUCT_NOT_EXSIT, "");
    }
コード例 #3
0
    public void purchaseProduct(string product)
    {
#if UNITY_ANDROID
        GoogleIAB.purchaseProduct(product);
#elif UNITY_IPHONE
        StoreKitBinding.purchaseProduct(product, 1);
#else
/*        string url = UI.Instance.getURL(product);
 *      FB.Canvas.Pay(url, "purchaseitem", 1, null, null, null, null, null, delegate(FBResult response) {
 *          object resp = Json.Deserialize(response.Text);
 *          Dictionary<string, object> infoItem = resp as Dictionary<string, object>;
 *          if (infoItem != null) {//HACKKKAKAKAKKAKKA
 *              //if (product == "com.bitoon.classicgolf.punadogemas") { //joyero
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg0ODI2NDgwMTUsImFtb3VudCI6IjEwLjAwIiwiY3VycmVuY3kiOiJFVVIiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQiLCJzaWduZWRfcmVxdWVzdCI6Imx2Zkg3Smt2ajY3MjJPMTVVRE9KNkU5UjdpNlFNczRTajJLUVRQdU9JYVEuZXlKaGJHZHZjbWwwYUcwaU9pSklUVUZETFZOSVFUSTFOaUlzSW1GdGIzVnVkQ0k2SWpFd0xqQXdJaXdpWTNWeWNtVnVZM2tpT2lKRlZWSWlMQ0pwYzNOMVpXUmZZWFFpT2pFek9UZ3lOVEV5T0RBc0luQmhlVzFsYm5SZmFXUWlPalEwTVRRNE9EUTRNalkwT0RBeE5Td2ljWFZoYm5ScGRIa2lPaUl4SWl3aWMzUmhkSFZ6SWpvaVkyOXRjR3hsZEdWa0luMCJ9");
 *              //} else if (product == "com.bitoon.classicgolf.bolsagemas") {  //saco
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg0ODkzMTQ2ODEsImFtb3VudCI6IjI1LjAwIiwiY3VycmVuY3kiOiJFVVIiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQiLCJzaWduZWRfcmVxdWVzdCI6IjZyMW8yX1IxQ1pOdHlHeUdvZXdGYjlKbTZ3WUxxV3FIajYzRWl1SHlBLW8uZXlKaGJHZHZjbWwwYUcwaU9pSklUVUZETFZOSVFUSTFOaUlzSW1GdGIzVnVkQ0k2SWpJMUxqQXdJaXdpWTNWeWNtVnVZM2tpT2lKRlZWSWlMQ0pwYzNOMVpXUmZZWFFpT2pFek9UZ3lOVEV6TkRZc0luQmhlVzFsYm5SZmFXUWlPalEwTVRRNE9EUTRPVE14TkRZNE1Td2ljWFZoYm5ScGRIa2lPaUl4SWl3aWMzUmhkSFZ6SWpvaVkyOXRjR3hsZEdWa0luMCJ9");
 *              //} else if (product == "com.bitoon.classicgolf.joyerogemas") {//cofre
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg0OTI2NDgwMTQsImFtb3VudCI6IjUwLjAwIiwiY3VycmVuY3kiOiJFVVIiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQiLCJzaWduZWRfcmVxdWVzdCI6Ill3eEJTM2p2WWlrVjdQbVhJemM5STluSUZoMklwaWw1Z3p4Y0UwNUNJTEUuZXlKaGJHZHZjbWwwYUcwaU9pSklUVUZETFZOSVFUSTFOaUlzSW1GdGIzVnVkQ0k2SWpVd0xqQXdJaXdpWTNWeWNtVnVZM2tpT2lKRlZWSWlMQ0pwYzNOMVpXUmZZWFFpT2pFek9UZ3lOVEUwTWpJc0luQmhlVzFsYm5SZmFXUWlPalEwTVRRNE9EUTVNalkwT0RBeE5Dd2ljWFZoYm5ScGRIa2lPaUl4SWl3aWMzUmhkSFZ6SWpvaVkyOXRjR3hsZEdWa0luMCJ9");
 *              //} else if (product == "com.bitoon.classicgolf.sacogemas") { // camion
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg1MzkzMTQ2NzYsImFtb3VudCI6IjEwMC4wMCIsImN1cnJlbmN5IjoiRVVSIiwicXVhbnRpdHkiOiIxIiwic3RhdHVzIjoiY29tcGxldGVkIiwic2lnbmVkX3JlcXVlc3QiOiJWUWR6eXBKMnBETGoyU0lBZ0NoaGd5NThwTUtFdW9IeWVFOW52cTROcjkwLmV5SmhiR2R2Y21sMGFHMGlPaUpJVFVGRExWTklRVEkxTmlJc0ltRnRiM1Z1ZENJNklqRXdNQzR3TUNJc0ltTjFjbkpsYm1ONUlqb2lSVlZTSWl3aWFYTnpkV1ZrWDJGMElqb3hNems0TWpVeU16UXpMQ0p3WVhsdFpXNTBYMmxrSWpvME5ERTBPRGcxTXprek1UUTJOellzSW5GMVlXNTBhWFI1SWpvaU1TSXNJbk4wWVhSMWN5STZJbU52YlhCc1pYUmxaQ0o5In0=");
 *              //} else if (product == "com.bitoon.classicgolf.cofregemas") { //000000
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
 *              //} else ;
 *              ////purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "",Convert.ToBase64String(Encoding.UTF8.GetBytes(response.Text)));
 *          }
 *     });
 */
#endif
    }
コード例 #4
0
    public void PurchaseReal(string productname)
    {
        SoundManager.Instance.PlaySound(8);


        switch (productname)
        {
        case "one.coin":
            StoreKitBinding.purchaseProduct("coin1", 1);
            break;

        case "three.coin":
            StoreKitBinding.purchaseProduct("coin2", 1);
            break;

        case "five.coin":
            StoreKitBinding.purchaseProduct("coin3", 1);
            break;

        case "nine.coin":
            StoreKitBinding.purchaseProduct("coin4", 1);
            break;

        case "intotheblack.vip":
            StoreKitBinding.purchaseProduct("VIP", 1);
            break;

        case "intotheblack.venus":
            StoreKitBinding.purchaseProduct("wingman", 1);
            break;

        default:
            break;
        }
    }
コード例 #5
0
    public void purchaseProduct(string code, int quantity)
    {
#if PURCHASE_USE_APPLE_ITUNES_PRIME31
        StoreKitBinding.purchaseProduct(code, quantity);
#elif PURCHASE_USE_AMAZON_PRIME31
        //AmazonIAP.initiatePurchaseRequest(GamePacks.currentGameBundle + "." + code);
        AmazonIAP.initiatePurchaseRequest(code);
#elif PURCHASE_USE_GOOGLE_PLAY_PRIME31
        GoogleIAB.purchaseProduct(code);
#elif PURCHASE_USE_UNITY
        productManager.PurchaseProduct(code);
#else
        // Web/PC
        purchaseProcessCompleted = true;

        ProductNetworkRecord data =
            ProductNetworkRecord.Create(
                code,
                "Product Purchase",
                "Product purchased:" + code,
                true,
                "TODO",
                "TODO",
                code,
                1,
                ProductNetworkType.typeThirdParty,
                ProductNetworkStoreType.typeAmazon,
                ProductNetworkConsumableType.consumable);

        BroadcastProductNetworksSuccess(data);
#endif
    }
コード例 #6
0
    /// <summary>
    /// 购买一个角色槽,可以多创建一个角色
    /// </summary>
    public void BuyPlayerSlot(UIToggle toggle)
    {
        //Debug.Log(string.Format("===================={0},{1}", BtnGameManager.yt,BtnGameManager.yt[0]["userEmail"].YuanColumnText));
        string userName = BtnManager.passID;
        string quDao    = TableRead.strPageName;

        toggle.value = false;
        btnStartGame.SetActive(false);

        //StartCoroutine (BeginTimeOut(15,3,ConnectInRoom,() => InRoom.GetInRoomInstantiate().GetBuyLanWei(userName, quDao),null));

#if SDK_ZSYIOS
        // 正版iOS平台内购相关逻辑
        int playerSlotCount = PlayerPrefs.GetInt("PlayerSlotCount", 2);
        if (playerSlotCount < 5)
        {
            StoreKitBinding.requestProductData("cszz.061");
            StoreKitBinding.purchaseProduct("cszz.061", 1);
        }
        else
        {
            warnings.warningAllTime.Show("", StaticLoc.Loc.Get("info1013"));
        }
#else
        //10月29号出封测包先注释掉
        InRoom.GetInRoomInstantiate().GetBuyLanWei(userName, quDao);
#endif
    }
コード例 #7
0
        public void PurchaseItem(ButtonEventArgs args)
        {
            if (!CoreUtility.Me.ShowInternetConnection())
            {
                return;
            }

#if (UNITY_IOS && !STOREKIT) || (UNITY_ANDROID && !GOOGLEIAB)
            PopupMessages.Me.InAppNotIntegratedMessage();
            return;
#endif

            string coststring;
            int    index;
            int.TryParse(args.data, out index);

            pID                  = InAppInfo[index].ID;
            isRestore            = false;
            isRestoreItemSuccess = false;
            coststring           = isProductReceived && isLocalStoreCost ? InAppInfo[index].CostStringLocaleBase : "$" + InAppInfo[index].CostUSD;
            MyDebug.Log("InAppManager::PurchaseItem => " + pID + ", " + index + ", " + InAppInfo[index].DisplayName + ", " + coststring);
            PopupMessages.Me.InAppProcessMessage(InAppInfo[index].DisplayName, coststring);

#if UNITY_EDITOR
            PurchaseSuccessful(pID, "UnityTest_" + System.DateTime.Now.ToOADate());
            return;
#endif

            #region iOS Methods
#if UNITY_IOS && !UNITY_EDITOR && STOREKIT
            StoreKitBinding.purchaseProduct(pID, 1);
#endif
            #endregion

            #region Android => Google Play Mathods
#if UNITY_ANDROID && !UNITY_EDITOR && !AMAZONSTORE && GOOGLEIAB
            GoogleIAB.queryInventory(inappids);
#endif
            #endregion

            #region Android => Amazon Store Methods
#if UNITY_ANDROID && !UNITY_EDITOR && AMAZONSTORE
#if UNDERGROUND
            pID = pID.Replace("supercell.", "supercell.underground.");
#endif

            if (unavailableSkus.Contains(pID))
            {
                ItemUnavailable(pID);
                return;
            }
            // Construct object passed to operation as input
            SkuInput request = new SkuInput();
            request.Sku = pID;
            // Call synchronous operation with input object
            RequestOutput response = iapService.Purchase(request);
#endif
            #endregion
        }
コード例 #8
0
    public static void buyItem(string itemID)
    {
#if UNITY_ANDROID
        GoogleIAB.purchaseProduct(itemID);
#elif UNITY_IPHONE
        StoreKitBinding.purchaseProduct(itemID, 1);
#endif
    }
コード例 #9
0
 protected override void Purchase(MarketLot lot)
 {
     Debug.Log("IOSBilling. Purchase lot:" + lot);
     if (_canMakePayments)
     {
         StoreKitBinding.purchaseProduct(lot.ProductIOSIdentifier, 1);
     }
 }
コード例 #10
0
 /// <summary>
 /// purchase non-consumable product based on its product id.
 /// Our delegates then fire the appropriate succeeded/fail event.
 /// Additionally, non-consumables are being saved to the database
 /// </summary>
 public static void PurchaseNonconsumableProduct(string productId)
 {
     productId = GetIAPObject(productId).GetIdentifier();
     #if UNITY_ANDROID
     GoogleIAB.purchaseProduct(productId, "nonconsume");
     #elif UNITY_IPHONE
     StoreKitBinding.purchaseProduct(productId, 1);
     #endif
 }
コード例 #11
0
ファイル: IAP.cs プロジェクト: SinKwangOn/frozen_free_fall
    // Purchases the given product and quantity. completionHandler provides if the purchase succeeded
    public static void purchaseNonconsumableProduct(string productId, Action <bool> completionHandler)
    {
        _purchaseCompletionAction = completionHandler;

#if UNITY_ANDROID
        GoogleIAB.purchaseProduct(productId, NON_CONSUMABLE_PAYLOAD);
#elif UNITY_IPHONE
        StoreKitBinding.purchaseProduct(productId, 1);
#endif
    }
コード例 #12
0
ファイル: AmIAP.cs プロジェクト: ekoRemDev/UnityGameSampleRPS
    //  _////////////////////////////////////////////////_    _____  Action  _____    구 매   _____
    public void PurchaseProduct(string pProductID)
    {
        Ag.LogStartWithStr(3, "Purchase Product >>>    " + pProductID + "   From Apple Count : " + ProdNumFromAppl);

        AgStt.IntendedPause = true; // 구매 진행 시작. Node close 방지.
        ReceiptOfIAP        = "";
        //ProductID = "com.appsgraphy.psykickbattlekakao." + pProductID; // cash0500 .. cash0030..
        ProductID = pProductID;
        StoreKitBinding.purchaseProduct(productIdentifier: ProductID, quantity: 1);
        Ag.LogString("      Sent  ...    " + ProductID);
    }
コード例 #13
0
    void myMakePurchaseMethod(UpsightPurchase purchase)
    {
        if (purchase != null)
        {
                        # if UNITY_IPHONE
            if (StoreKitBinding.canMakePayments())
            {
                StoreKitBinding.purchaseProduct(purchase.productIdentifier, purchase.quantity);
            }
                        # endif

                        # if UNITY_ANDROID
コード例 #14
0
 public void DoBuyCoins1000()
 {
     ShowConnectingiTunesPanel();
     if (CheckProductData(IAP_PROD_Coins1000))
     {
         StoreKitBinding.purchaseProduct(IAP_PROD_Coins1000, 1);
     }
     else
     {
         PurchaseFailed();
     }
 }
コード例 #15
0
    public void BuyProduct(IAP iap)
    {
        IAPUnit mIap = mInAppProducts.Find(f => (f.mIap == iap));

        #if UNITY_ANDROID
        GoogleIAB.purchaseProduct(mIap.IAP_Id);
        #endif

        #if UNITY_IOS
        StoreKitBinding.purchaseProduct(mIap.IAP_Id, 1);
        #endif
    }
コード例 #16
0
 public bool PurchaseRemoveAds()
 {
     if (_products != null && _products.Count > 0)
     {
         Debug.Log("preparing to purchase product: eu.machten.Bee.removeads");
         StoreKitBinding.purchaseProduct("eu.machten.Bee.removeads", 1);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #17
0
 public bool Purchase10ExtraLives()
 {
     if (_products != null && _products.Count > 0)
     {
         Debug.Log("preparing to purchase product: eu.machten.Bee.10extralives");
         StoreKitBinding.purchaseProduct("eu.machten.Bee.10extralives", 1);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #18
0
    void onPurchasing(SuppliesUIObject item, GameObject tag)
    {
        if (tag.tag == "GoldButton")
        {
            Debug.Log(tag.name);

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                ChartBoostBinding.trackEvent("Gold Buy Attempt");
            }

            if (tag.name == "Gold")
            {
                tweenIn();
            }
            else if (tag.name == "GoldButtonBG")
            {
                tweenOut();
            }
            else if (tag.name == "Coins_L1")
            {
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
                tweenOut();
#elif UNITY_IPHONE
                EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
                StoreKitBinding.purchaseProduct(MainMenuController.GOLD_200, 1);
#endif
            }
            else if (tag.name == "Coins_L2")
            {
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
                tweenOut();
#elif UNITY_IPHONE
                EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
                StoreKitBinding.purchaseProduct(MainMenuController.GOLD_500, 1);
#endif
            }
            else if (tag.name == "Coins_L3")
            {
#if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
                tweenOut();
#elif UNITY_IPHONE
                EtceteraBinding.showBezelActivityViewWithLabel("Connecting to iTunes Store...");
                StoreKitBinding.purchaseProduct(MainMenuController.GOLD_4000, 1);
#endif
            }
        }
    }
コード例 #19
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
     {
         productId = GetIAPObject(productId).GetIdentifier();
         #if UNITY_ANDROID
         GoogleIAB.purchaseProduct(productId, "consume");
         #elif UNITY_IPHONE
         StoreKitBinding.purchaseProduct(productId, 1);
         #endif
     }
 }
コード例 #20
0
 /// <summary>
 /// purchase subscription based on its product id.
 /// Our delegates then fire the appropriate succeeded/fail event.
 /// On Android we have to check whether subscriptions are supported
 /// </summary>
 public static void PurchaseSubscription(string productId)
 {
     productId = GetIAPObject(productId).GetIdentifier();
     #if UNITY_ANDROID
     if (GoogleIAB.areSubscriptionsSupported())
     {
         GoogleIAB.purchaseProduct(productId);
     }
     else
     {
         BillingNotSupported("Subscriptions not available.");
     }
     #elif UNITY_IPHONE
     StoreKitBinding.purchaseProduct(productId, 1);
     #endif
 }
コード例 #21
0
    protected virtual void attemptUpgrade()
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
#if UNITY_IPHONE
#if GOT_PRIME31_STORE_KIT_PLUGIN
            StoreKitBinding.purchaseProduct(productID, 1);
#endif
#endif
        }
        else
        {
            int curGold = Globals.getTotalScore(0);
            Globals.setTotalScore(curGold + goldBonus);
        }
    }
コード例 #22
0
    public void NoAds()
    {
        Main.Instance.PlayButtonSound();

                #if UNITY_IOS
        if (_products != null && _products.Count > 0)
        {
            int productIndex = 0;              //We have only one product	// Random.Range( 0, _products.Count );
            var product      = _products[productIndex];

            Debug.Log("preparing to purchase product: " + product.productIdentifier);
            StoreKitBinding.purchaseProduct(product.productIdentifier, 1);
        }
                #elif UNITY_ANDROID
        GoogleIAB.purchaseProduct(Constants.PRODUCT_ID);
//		GoogleIAB.purchaseProduct( "android.test.purchased" );
                #endif
    }
コード例 #23
0
    //결제요청 하기
    public void RequestPayment(string _productID, ushort _shopIdx)
    {
        UserEditor.Getsingleton.EditLog("purchase productID :" + _productID);
        UserEditor.Getsingleton.EditLog("purchase _shopIdx :" + _shopIdx);
        buyProductID = _productID;
        ShopIdx      = _shopIdx;



#if UNITY_ANDROID
        Loadmanager.instance.LoadingUI(true);
        GoogleIAB.purchaseProduct(_productID);
#elif UNITY_IOS
        //구매진행중 ON
        isPurchasing = true;

        //로딩방 활성화
        Loadmanager.instance.LoadingUI(true);

        StoreKitBinding.purchaseProduct(_productID, 1);
#endif
    }
コード例 #24
0
    public void buyProductWithId(int productID, int number)
    {
        Debug.Log("Can makePurshe?");
        if (!canMakePayments)
        {
            Debug.Log("No");
            InitialiseStoreKit();
            Debug.Log("Return");
            return;
        }
        Debug.Log("Yes");

        var productIndex = productID;

        if (_products != null)
        {
            if (_products.Count > productIndex)
            {
                Debug.Log(_products.Count + "");
            }
            else
            {
                Debug.Log("No products");
                NoInternetConnection.SetActive(true);
                return;
            }
        }
        else
        {
            Debug.Log("No products - null");
            NoInternetConnection.SetActive(true);
            return;
        }
        var product = _products[productIndex];

        Debug.Log("preparing to purchase product: " + product.productIdentifier);
        StoreKitBinding.purchaseProduct(product.productIdentifier, 1);
    }
コード例 #25
0
    // Update is called once per frame
    void Update()
    {
        if (PlayerPrefs.GetInt("FullGame") > 1)
        {
            Destroy(gameObject, 0.3f);
        }


        if (Input.GetMouseButtonDown(0))
        {
            Vector3 pos = Input.mousePosition;


            if (Cancel.HitTest(pos))
            {
                audio.PlayOneShot(clicksound);
                _Hud.bPause = false;
                Application.LoadLevel("Menu");
            }

            if (BuyButton.HitTest(pos))
            {
                audio.PlayOneShot(clicksound);
                StoreKitBinding.purchaseProduct("TTLFULLGAME", 1);
                BuyButton.gameObject.SetActiveRecursively(false);
                StartCoroutine(WaitForBuy(2.0f));
            }
        }


        if (PlayerPrefs.GetInt("FullGame") > 0)
        {
            _Hud.bPause    = true;
            Time.timeScale = 1;
            Destroy(gameObject);
        }
    }
コード例 #26
0
        void StartPurchase()
        {
            mPurchaseReady = false; // disable button when clicked
            KongregateAPI kongregate           = KongregateAPI.GetAPI();
            Dictionary <string, object> fields = new Dictionary <string, object> ()
            {
                { "type", "Gold Pack" },
                { "discount_percent", 12.5 },
                { "context_of_offer", "StoreFront" }
            };

      #if UNITY_IPHONE
            kongregate.Analytics.StartPurchase("com.kongregate.mobile.games.angryBots.t05_coins", 1, fields);
            StoreKitBinding.purchaseProduct("com.kongregate.mobile.games.angryBots.t05_coins", 1);
      #elif UNITY_ANDROID
            kongregate.Analytics.StartPurchase("com.kongregate.android.games.angrybots.t03_hard", 1, fields);
            GoogleIAB.purchaseProduct("com.kongregate.android.games.angrybots.t03_hard");
      #elif UNITY_WEBPLAYER || UNITY_WEBGL
            kongregate.Analytics.StartPurchase("com.kongregate.web.angrybots.t05_hard", 1, fields);

            // Use the Javascript API to initiate the purchase. Notice in this flow we call finishPurchase via
            // the Javascript API after the purchase is completed by serializing the game fields needed. You
            // could also save the game fields into a variable in your Unity script and then call
            // kongregate.Analytics.FinishPurchase(...) in the Unity callback as well.
            Application.ExternalEval(string.Format(
                                         @"kongregate.mtx.purchaseItems(['com.kongregate.web.angrybots.t05_hard'], function(result){{
                var status = result.success ? 'SUCCESS' : 'FAIL';
                var data = result.success ? '{0}' : '{1}';
                kongregate.analytics.finishPurchase(status, result.purchase_id, data);

                // Fire the callback in the Unity code
                kongregateUnitySupport.getUnityObject().SendMessage('Kongregate', 'OnKredPurchaseResult', status);
            }});"
                                         , Analytics.toAnalyticEventJSON(getPurchaseFields()), Analytics.toAnalyticEventJSON(fields)));
                        #endif
        }
コード例 #27
0
    public override void PurchaseProduct(InAppPurchase purchase)
    {
#if UNITY_EDITOR
        base.PurchaseProduct(purchase);
#elif UNITY_IPHONE
        if (StoreKitBinding.canMakePayments())
        {
            purchasingProduct = purchase;

            RequestProductList();

            StoreKitManager.productPurchaseAwaitingConfirmationEvent += OnProductAwaitingVerification;
            StoreKitManager.purchaseFailedEvent    += OnProductFailed;
            StoreKitManager.purchaseCancelledEvent += OnProductCanceled;

            Debug.Log("Purchasing product: " + productIds[(int)purchasingProduct]);
            StoreKitBinding.purchaseProduct(GetPurchaseId(purchase), 1);
        }
        else
        {
            OnInAppDisabled(purchase);
        }
#endif
    }
コード例 #28
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();
    }
コード例 #29
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");
        }
    }
コード例 #30
0
    // fund 2000

    /*
     * 1. 10,000 gram Gold for 5 Strong Engine
     *      : Strong engine can destroy everything by collide.. it's a great engine to make scores..
     * 2. 30,000 Gram Gold for 10 Gost Engine
     *      : Ghost Engine can Go as fast as inside any objects this is a so amaizing engine ever.. buy this engine to make more score
     * 3. 50,000 Grams Gold for 10 Magnet Engine
     *      : It's a Magnet Field Engine it can destroy all obstracles and collect gold stone and coins autometically.. buy this engine..
     *      Enjoy a funny train journey
     *
     *
     * 1. 30,000 gram Gold at $1
     * 2. 70,000 gram Gold at $1.99
     *
     *
     *
     *
     */



    void Update()
    {
        CoinsDeposit.GetComponent <TextMesh>().text = "" + gold;
        HealthText.GetComponent <TextMesh>().text   = "" + Health;
        HB1_details.GetComponent <TextMesh>().text  = "Protect yourself \nfrom Front Collision..\nSpending 5,000 coins";
        HB2_details.GetComponent <TextMesh>().text  = "Protect yourself \nforever from Front \nCollision... does not\nmatter the obstacle \nsize..and quantity.. ";
        CB1_details.GetComponent <TextMesh>().text  = "Get coins and use \nother features...";
        CB2_details.GetComponent <TextMesh>().text  = "Get Mega coins and \nuse other features...\ndon't worry.. about\nmissed coins.. on \nGame play";
        CXB1_details.GetComponent <TextMesh>().text = "Get Double coins value\nenjoy more funn...";
        CXB2_details.GetComponent <TextMesh>().text = "4x multiply coins value\nenjoy more funn...";
        EB1_details.GetComponent <TextMesh>().text  = "Unlock Challengeing \nnever die Ghost mode \nIt is incredible.. \nrealy great..";
        EB2_details.GetComponent <TextMesh>().text  = "Unlock Super Mode.\nfeel your joy\nand funn with game.";

        if (PlayerPrefs.GetInt("M_Health") > 0)
        {
            _hbuy2.SetActiveRecursively(false);
        }
        else
        {
            _hbuy2.SetActiveRecursively(true);
        }

        if (PlayerPrefs.GetInt("COIN2X") > 0)
        {
            _cxbuy1.SetActiveRecursively(false);
        }
        else
        {
            _cxbuy1.SetActiveRecursively(true);
        }


        if (PlayerPrefs.GetInt("COIN4X") > 0)
        {
            _cxbuy2.SetActiveRecursively(false);
        }
        else
        {
            _cxbuy2.SetActiveRecursively(true);
        }

        if (PlayerPrefs.GetInt("S_ENG") > 0)
        {
            _engbuy2.SetActiveRecursively(false);
        }
        else
        {
            _engbuy2.SetActiveRecursively(true);
        }


        if (PlayerPrefs.GetInt("G_ENG") > 0)
        {
            _engbuy1.SetActiveRecursively(false);
        }
        else
        {
            _engbuy1.SetActiveRecursively(true);
        }



        if (Input.GetMouseButtonDown(0))
        {
            Vector3 touchPos = Input.mousePosition;

            if (Back.HitTest(touchPos))
            {
                _StoreMenu.isS_Close = true;
                PlayerPrefs.SetInt("Health", Health);
                StartCoroutine(waitlevels(0.9f));
                audio.PlayOneShot(ActionSound);
            }
            if (Restore.HitTest(touchPos))
            {
                audio.PlayOneShot(ActionSound);
                StoreKitBinding.restoreCompletedTransactions();
            }

            ray = Camera.main.ScreenPointToRay(Input.mousePosition);


            if (Physics.Raycast(ray, out hit, 500))
            {
                if (hit.collider.tag == "_hbuy1")                                                // 5000 coins >>

                {
                    audio.PlayOneShot(ActionSound);
                    if (gold > 4999)
                    {
                        Health += 24;
                        gold   -= 5000;
                    }

                    // Heale += 24;
                }
                if (hit.collider.tag == "_hbuy2")                                                // 40,000 coins $0.99
                {
                    audio.PlayOneShot(ActionSound);
                    if (gold > 39999)
                    {
                        PlayerPrefs.SetInt("M_Health", 2);                                                        // true
                        gold -= 40000;
                    }
                    else
                    {
                        StoreKitBinding.purchaseProduct("HMpack", 1);
                    }
                }
                if (hit.collider.tag == "_cbuy1")                                               //$0.99  >>
                {
                    audio.PlayOneShot(ActionSound);
                    //gold += 50000;
                    StoreKitBinding.purchaseProduct("CSpack", 1);
                }
                if (hit.collider.tag == "_cbuy2")                                                //$1.99 >>
                {
                    audio.PlayOneShot(ActionSound);
                    //gold+= 900000;
                    StoreKitBinding.purchaseProduct("CMpack", 1);
                }
                if (hit.collider.tag == "_cxbuy1")                                                // 50,000 coins
                {
                    audio.PlayOneShot(ActionSound);
                    if (gold > 49999)
                    {
                        PlayerPrefs.SetInt("COIN2X", 2);
                        gold -= 50000;
                    }
                }
                if (hit.collider.tag == "_cxbuy2")                                                //3,00,000 coins $0.99
                {
                    audio.PlayOneShot(ActionSound);
                    if (gold > 299999)
                    {
                        gold -= 300000;
                        PlayerPrefs.SetInt("COIN4X", 2);
                    }
                    else
                    {
                        StoreKitBinding.purchaseProduct("CXpack", 1);
                    }
                }
                if (hit.collider.tag == "_engbuy1")                                               //7,00,000 coins $1.99
                {
                    audio.PlayOneShot(ActionSound);
                    if (gold > 699999)
                    {
                        gold -= 700000;
                        PlayerPrefs.SetInt("G_ENG", 2);
                    }
                    else
                    {
                        StoreKitBinding.purchaseProduct("ESpack", 1);
                    }
                }
                if (hit.collider.tag == "_engbuy2")                                               //9,00,000 coins $2.99
                {
                    audio.PlayOneShot(ActionSound);
                    if (gold > 899999)
                    {
                        gold -= 900000;
                        PlayerPrefs.SetInt("S_ENG", 2);
                    }
                    else
                    {
                        StoreKitBinding.purchaseProduct("EMpack", 1);
                    }
                }
            }
        }
    }