コード例 #1
0
ファイル: AmIAP.cs プロジェクト: ekoRemDev/UnityGameSampleRPS
    //  _////////////////////////////////////////////////_    _____   Action   _____    상품 리스트 가져오기    _____
    public void ProductRequest()
    {
        Ag.LogIntenseWord("Product Request ");
        var productIdentifiers = new string[] {
            "com.appsgraphy.kvsskakao.cash0030_test",
            "com.appsgraphy.kvsskakao.cash0050_test",
            "com.appsgraphy.kvsskakao.cash0100_test",
            "com.appsgraphy.kvsskakao.cash0330_test",
            "com.appsgraphy.kvsskakao.cash0600_test",
            "com.appsgraphy.kvsskakao.cash1300_test",
            "com.appsgraphy.kvsskakao.popupstore01_test",
            "com.appsgraphy.kvsskakao.popupstore02_test",
            "com.appsgraphy.kvsskakao.popupstore03_test",
            "com.appsgraphy.kvsskakao.popupstore04_test",
            "com.appsgraphy.kvsskakao.popupstore05_test",
            "com.appsgraphy.kvsskakao.popupstore06_test",
            "com.appsgraphy.kvsskakao.popupstore07_test",
            "com.appsgraphy.kvsskakao.popupstore08_test"

//            "com.appsgraphy.psykickbattlekakao.cash0500",
//            "com.appsgraphy.psykickbattlekakao.cash1000",
//            "com.appsgraphy.psykickbattlekakao.cash1000",
//            "com.appsgraphy.psykickbattlekakao.cash1000"
        };

        StoreKitBinding.requestProductData(productIdentifiers);
    }
コード例 #2
0
    public void RequestProductData()
    {
        // array of product ID's from iTunesConnect. MUST match exactly what you have there!
        var productIdentifiers = new string[] { "eu.machten.Bee.extralives", "eu.machten.Bee.removeads", "eu.machten.Bee.10extralives" };

        StoreKitBinding.requestProductData(productIdentifiers);
    }
コード例 #3
0
 public void InitialiseStoreKit()
 {
     canMakePayments = StoreKitBinding.canMakePayments();
     Debug.Log("StoreKit canMakePayments: " + canMakePayments);
     if (isFree)
     {
         var productIdentifiers = new string[] {
             "com.DMDEnterprise.kicktheballfree.100coins",
             "com.DMDEnterprise.kicktheballfree.250coins",
             "com.DMDEnterprise.kicktheballfree.500coins",
             "com.DMDEnterprise.kicktheballfree.1500coins",
             "com.DMDEnterprise.kicktheballfree.3000coins",
             "com.DMDEnterprise.kicktheballfree.5000coins"
         };
         StoreKitBinding.requestProductData(productIdentifiers);
     }
     else
     {
         var productIdentifiers = new string[] {
             "com.immanitas.KickTheBall.100coins",
             "com.immanitas.KickTheBall.250coins",
             "com.immanitas.KickTheBall.500coins",
             "com.immanitas.KickTheBall.1500coins",
             "com.immanitas.KickTheBall.3000coins",
             "com.immanitas.KickTheBall.5000coins"
         };
         StoreKitBinding.requestProductData(productIdentifiers);
     }
 }
コード例 #4
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
    }
コード例 #5
0
 // when billing is supported on the device,
 // this method requests IAP product data from Google/Apple
 private void RequestProductData()
 {
     #if UNITY_IPHONE
     StoreKitBinding.requestProductData(ids);
     #elif UNITY_ANDROID
     GoogleIAB.queryInventory(ids);
     #endif
 }
コード例 #6
0
    protected override void PlatformRequestProductList(string[] products)
    {
#if UNITY_IPHONE
        StoreKitManager.productListReceivedEvent -= OnProductListReceived;
        StoreKitManager.productListReceivedEvent += OnProductListReceived;

        StoreKitBinding.requestProductData(products);
#endif
    }
コード例 #7
0
ファイル: GoldShop.cs プロジェクト: classified/Space-Shooter
 void Start()
 {
     StoreKitBinding.requestProductData(productList);
     StoreKitManager.productListReceivedEvent += allProducts =>
     {
         Debug.Log("received total products: " + allProducts.Count);
         _products = allProducts;
     };
 }
コード例 #8
0
        //
        //
        #region "iOS Events Handelers"
#if UNITY_IOS && STOREKIT
        void RequestProduct()
        {
            if (isProductReceived)
            {
                CancelInvoke("RequestProduct");
                return;
            }
            MyDebug.Log("Requesting product for the iOS");
            StoreKitBinding.requestProductData(inappids);
        }
コード例 #9
0
ファイル: IAP.cs プロジェクト: Veryphone/VeryGitHub
    // Accepts two arrays of product identifiers (one for iOS one for Android). All of the products you have for sale should be requested in one call.
    public static void requestProductData(string[] iosProductIdentifiers, string[] androidSkus, Action <List <IAPProduct> > completionHandler)
    {
        _productListReceivedAction = completionHandler;

#if UNITY_ANDROID
        GoogleIAB.queryInventory(androidSkus);
#elif UNITY_IPHONE
        StoreKitBinding.requestProductData(iosProductIdentifiers);
#endif
    }
コード例 #10
0
    public static void getItems()
    {
        string[] _idItems = new string[] { BillingItemsIDs.teeth_01, BillingItemsIDs.teeth_02,
                                           BillingItemsIDs.teeth_03, BillingItemsIDs.teeth_04 };

#if UNITY_ANDROID
        GoogleIAB.queryInventory(_idItems);
#elif UNITY_IPHONE
        StoreKitBinding.requestProductData(_idItems);
#endif
    }
コード例 #11
0
 public override void Start()
 {
     base.Start();
     Debug.Log("iOS billing is starting.");
     _canMakePayments = StoreKitBinding.canMakePayments();
     Debug.Log("IOBilling. Can make payments:" + _canMakePayments);
     if (_canMakePayments)
     {
         Debug.Log("iOSBilling. Request Product data:");
         StoreKitBinding.requestProductData(MarketLot.AllLots.Select(l => l.ProductIOSIdentifier).ToArray());
     }
 }
コード例 #12
0
    public void RequestProductList(string productIdentifiers)
    {
        string[] skus = productIdentifiers.Split(',');

#if PURCHASE_USE_APPLE_ITUNES_PRIME31
        StoreKitBinding.requestProductData(skus);
#elif PURCHASE_USE_AMAZON_PRIME31
        AmazonIAP.initiateItemDataRequest(skus);
#elif PURCHASE_USE_GOOGLE_PLAY_PRIME31
        GoogleIAB.queryInventory(skus);
#else
        // Web/PC
        Debug.Log("skus" + skus.ToJson());
#endif
    }
コード例 #13
0
    //상품리스트 못받아올떄 콜백함수
    void productListRequestFailedEvent(string error)
    {
        UserEditor.Getsingleton.EditLog("productListRequestFailedEvent: " + error);

        IsGetQueryInventory = false;

        // 상품 정보 못가져오면 다시 가져오기 시도
        //Loadmanager.instance.LoadingUI(true);
        StoreKitManager.productListReceivedEvent += allProducts =>
        {
            UserEditor.Getsingleton.EditLog("received total products: " + allProducts.Count);
            Products = allProducts;
        };
        UserEditor.Getsingleton.EditLog(" Again requestProductData ~~~~~~~~~~");
        StoreKitBinding.requestProductData(productIDs);
    }
コード例 #14
0
    // Use this for initialization
    void Start()
    {
        canRestored = false;
        // array of product ID's from iTunesConnect. MUST match exactly what you have there!
                #if UNITY_IOS
        StoreKitManager.autoConfirmTransactions = true;
        var productIdentifiers = new string[] { Constants.PRODUCT_ID };
        StoreKitBinding.requestProductData(productIdentifiers);
                #elif UNITY_ANDROID
        var skus = new string[] { Constants.PRODUCT_ID };
//		var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" };
        GoogleIAB.queryInventory(skus);
                #endif

        HZIncentivizedAd.SetDisplayListener(videoAdListener);
        GameInit();
    }
コード例 #15
0
    public override void Init()
    {
        PRODUCT_IDENTIFIERS[0] = GOLD_200;
        PRODUCT_IDENTIFIERS[1] = GOLD_500;
        PRODUCT_IDENTIFIERS[2] = GOLD_4000;

        Application.targetFrameRate = 45;

        GameObject gcm;
        GameObject skm;
        GameObject etcm;
        GameObject etcl;
        GameObject cbm;

        if (GameObject.Find("GameCenterManager") == null && GameObject.Find("GameCenterManager(Clone)") == null)
        {
            gcm = (GameObject)Instantiate(Resources.Load(PRIME31_DIRECTORY + "GameCenterManager"));
        }
        if (GameObject.Find("StoreKitManager") == null && GameObject.Find("StoreKitManager(Clone)") == null)
        {
            skm = (GameObject)Instantiate(Resources.Load(PRIME31_DIRECTORY + "StoreKitManager"));
        }
        if (GameObject.Find("EtceteraManager") == null && GameObject.Find("EtceteraManager(Clone)") == null)
        {
            etcm = (GameObject)Instantiate(Resources.Load(PRIME31_DIRECTORY + "EtceteraManager"));
        }
        if (GameObject.Find("EtceteraEventListener") == null && GameObject.Find("EtceteraEventListener(Clone)") == null)
        {
            etcl = (GameObject)Instantiate(Resources.Load(PRIME31_DIRECTORY + "EtceteraEventListener"));
        }
        if (GameObject.Find("ChartBoostManager") == null && GameObject.Find("ChartBoostManager(Clone)") == null)
        {
            cbm = (GameObject)Instantiate(Resources.Load(PRIME31_DIRECTORY + "ChartBoostManager"));
        }

#if UNITY_IPHONE
        ChartBoostBinding.init(CHARTBOOST_APPID, CHARTBOOST_SIGNATURE);
        StoreKitBinding.requestProductData(PRODUCT_IDENTIFIERS);

        if (GameCenterBinding.isGameCenterAvailable())
        {
            GameCenterBinding.authenticateLocalPlayer();
        }
#endif
    }
コード例 #16
0
   void SetupPurchases()
   {
       Debug.Log("KongStoreKitDemo: Setting up purchases...");
 #if UNITY_IPHONE
       Debug.Log("KongStoreKitDemo: requesting products");
       StoreKitBinding.requestProductData(new string[] { "com.kongregate.mobile.games.angryBots.t05_coins" });
 #elif UNITY_ANDROID
       GoogleIABManager.billingSupportedEvent += () => {
           Debug.Log("KongStoreKitDemo: billing is supported query inventory");
           mPurchaseReady = true;
           var skus = new string[] { "com.kongregate.android.games.angrybots.t03_hard" };
           GoogleIAB.queryInventory(skus);
       };
       GoogleIABManager.queryInventorySucceededEvent += (purchases, skus) => {
           Debug.Log("KongStoreKitDemo: queryInventory succeeded");
           foreach (GooglePurchase purchase in purchases)
           {
               Debug.Log("KongStoreKitDemo: queryInventory succeeded: " + purchase.productId);
               verifyGoogleReceipt(purchase);
           }
       };
       GoogleIABManager.queryInventoryFailedEvent += (sku) => {
           Debug.Log("KongStoreKitDemo: queryInventoryFailedEvent: " + sku);
       };
       GoogleIABManager.purchaseSucceededEvent += purchase => {
           Debug.Log("Google IAB callback - purchased product: " + purchase);
           verifyGoogleReceipt(purchase);
       };
       GoogleIABManager.purchaseFailedEvent += message => {
           Debug.Log("Google IAB callback - purchase failed: " + message);
           KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL,
                                                           message, getPurchaseFields());
           mPurchaseReady = true;
       };
       GoogleIABManager.consumePurchaseSucceededEvent += purchase => {
           Debug.Log("KongStoreKitDemo: Google IAB callback - consume succeeded: " + purchase);
       };
       GoogleIABManager.consumePurchaseFailedEvent += message => {
           Debug.Log("Google IAB callback - consume failed: " + message);
       };
       GoogleIAB.init(_GooglePublicKey);
 #elif UNITY_WEBPLAYER || UNITY_WEBGL
       mPurchaseReady = true;
 #endif
   }
コード例 #17
0
    void Start()
    {
        LanguageManager thisLanguageManager = LanguageManager.Instance;

        welcome.text      = thisLanguageManager.GetTextValue("UI.StoreTitle");
        product1.text     = thisLanguageManager.GetTextValue("UI.Product1");
        product1desc.text = thisLanguageManager.GetTextValue("UI.Product1Desc");
        product2.text     = thisLanguageManager.GetTextValue("UI.Product2");
        product2desc.text = thisLanguageManager.GetTextValue("UI.Product2Desc");
        product3.text     = thisLanguageManager.GetTextValue("UI.Product3");
        product4.text     = thisLanguageManager.GetTextValue("UI.Product4");
        product5.text     = thisLanguageManager.GetTextValue("UI.Product5");
        product6.text     = thisLanguageManager.GetTextValue("UI.Product6");
        storeThanks.text  = thisLanguageManager.GetTextValue("UI.StoreThanks");


        StoreKitManager.productListReceivedEvent += allProducts =>
        {
            Debug.Log("received total products: " + allProducts.Count);
            _products = allProducts;
        };

        bool canMakePayments = StoreKitBinding.canMakePayments();

        Debug.Log("StoreKit canMakePayments: " + canMakePayments);

        // array of product ID's from iTunesConnect. MUST match exactly what you have there!
        var productIdentifiers = new string[] { "coin1", "coin3", "coin4", "coin2", "VIP", "wingman" };

        StoreKitBinding.requestProductData(productIdentifiers);



//		if( GUILayout.Button( "Restore Completed Transactions" ) )
//		{
//			StoreKitBinding.restoreCompletedTransactions();
//		}


//		if( GUILayout.Button( "Enable High Detail Logs" ) )
//		{
//			StoreKitBinding.enableHighDetailLogs( true );
//		}
    }
コード例 #18
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
    }
コード例 #19
0
    //TODO
    private void QueryInventory()
    {
        //Add Original Skus Here
        List <string> prodIDs = new List <string>();

        for (int i = 0; i < mInAppProducts.Count; i++)
        {
            prodIDs.Add(mInAppProducts[i].IAP_Id);
        }

        string[] skus = prodIDs.ToArray();

        #if UNITY_ANDROID
        GoogleIAB.queryInventory(skus);
        #endif

        #if UNITY_IOS
        StoreKitBinding.requestProductData(skus);
        #endif
    }
コード例 #20
0
    void Start()
    {
        // you cannot make any purchases until you have retrieved the products from the server with the requestProductData method
        // we will store the products locally so that we will know what is purchaseable and when we can purchase the products
        StoreKitManager.productListReceivedEvent += allProducts =>
        {
            Debug.Log("received total products: " + allProducts.Count);
            _products = allProducts;
        };

        canMakePayments = StoreKitBinding.canMakePayments();
        Debug.Log("StoreKit canMakePayments: " + canMakePayments);
        if (isFree)
        {
            var productIdentifiers = new string[] {
                "com.DMDEnterprise.kicktheballfree.100coins",
                "com.DMDEnterprise.kicktheballfree.250coins",
                "com.DMDEnterprise.kicktheballfree.500coins",
                "com.DMDEnterprise.kicktheballfree.1500coins",
                "com.DMDEnterprise.kicktheballfree.3000coins",
                "com.DMDEnterprise.kicktheballfree.5000coins"
            };
            StoreKitBinding.requestProductData(productIdentifiers);
        }
        else
        {
            var productIdentifiers = new string[] {
                "com.immanitas.KickTheBall.100coins",
                "com.immanitas.KickTheBall.250coins",
                "com.immanitas.KickTheBall.500coins",
                "com.immanitas.KickTheBall.1500coins",
                "com.immanitas.KickTheBall.3000coins",
                "com.immanitas.KickTheBall.5000coins"
            };
            StoreKitBinding.requestProductData(productIdentifiers);
        }
        StoreKitManager.purchaseSuccessfulEvent += purchaseSuccessful;
    }
コード例 #21
0
    public void Buy(string pid, DelFinish onFinish)
    {
        isBuying       = true;
        CurProduct.pid = pid;
        m_delFinish    = onFinish;
#if UNITY_IPHONE
        if (StoreKitBinding.canMakePayments())
        {
            string[] strRequests = { pid };
            StoreKitBinding.requestProductData(strRequests);
        }
        else
        {
            BuyFail(FailType.CANNOTBUY, "");
            Debug.Log("can't purchase");
        }
#else
        if (null != m_delFinish)
        {
            m_delFinish(false);
        }
#endif
    }
コード例 #22
0
    void OnGUI()
    {
        float yPos       = 5.0f;
        float xPos       = 5.0f;
        float width      = (Screen.width >= 960 || Screen.height >= 960) ? 320 : 160;
        float height     = (Screen.width >= 960 || Screen.height >= 960) ? 80 : 40;
        float heightPlus = height + 10.0f;

        if (GUI.Button(new Rect(xPos, yPos, width, height), "Get Can Make Payments"))
        {
            bool canMakePayments = StoreKitBinding.canMakePayments();
            Debug.Log("StoreKit canMakePayments: " + canMakePayments);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Get 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 (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Restore Completed Transactions"))
        {
            StoreKitBinding.restoreCompletedTransactions();
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Validate Receipt"))
        {
            // grab the transactions, then just validate the first one
            List <StoreKitTransaction> transactionList = StoreKitBinding.getAllSavedTransactions();
            if (transactionList.Count > 0)
            {
                StoreKitBinding.validateReceipt(transactionList[0].base64EncodedTransactionReceipt, true);
            }
        }

        // Second column
        xPos = Screen.width - width - 5.0f;
        yPos = 5.0f;

        // enforce the fact that we can't purchase products until we retrieve the product data
        if (_products != null && _products.Count > 0)
        {
            if (GUI.Button(new Rect(xPos, yPos, width, height), "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 (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Validate Subscription"))
        {
            // grab the transactions and if we have a subscription in there validate it
            List <StoreKitTransaction> transactionList = StoreKitBinding.getAllSavedTransactions();
            foreach (var t in transactionList)
            {
                if (t.productIdentifier == "sevenDays")
                {
                    StoreKitBinding.validateAutoRenewableReceipt(t.base64EncodedTransactionReceipt, "YOUR_SECRET_FROM_ITC", true);
                    break;
                }
            }
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "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");
            }
        }
    }
コード例 #23
0
    // Demonstrate how you might setup purchases using the Prime31 Plugin, and notify our SDK of the results.
    void DemoSetupPurchases()
    {
        mTransactionsInVerification = new Dictionary <string, object>(); //queue of transactions needing to be verified
#if UNITY_IPHONE && PRIME31_STOREKIT
        StoreKitManager.productListReceivedEvent += allProducts => {
            Debug.Log("received total products: " + allProducts.Count);
            mPurchaseReady = true;
        };

        // the following handles receipt verification
        StoreKitManager.autoConfirmTransactions = false;                                  //don't autoconfirm transactions until we have verified the receipt
        StoreKitManager.productPurchaseAwaitingConfirmationEvent += transaction => {
            mTransactionsInVerification[transaction.transactionIdentifier] = transaction; //add this transaction to the queue
            KongregateAPI.GetAPI().Mtx.VerifyTransactionId(transaction.transactionIdentifier);
        };

        StoreKitManager.purchaseFailedEvent += errorMsg => {
            Debug.Log("purchase failed: " + errorMsg);
            // pass null, if you do not have the transaction id.
            KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL, null,
                                                            getPurchaseFields());
            mPurchaseReady = true;
        };

        StoreKitManager.purchaseCancelledEvent += errorMsg => {
            Debug.Log("purchase cancelled: " + errorMsg);
            // pass null, if you do not have the transaction id.
            KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL, null,
                                                            getPurchaseFields());
            mPurchaseReady = true;
        };

        StoreKitBinding.requestProductData(new string[] { "com.kongregate.mobile.games.angryBots.t05_coins" });
#elif UNITY_ANDROID && PRIME31_STOREKIT
        GoogleIABManager.billingSupportedEvent += () => {
            Debug.Log("billing is supported");
            mPurchaseReady = true;
            var skus = new string[] { "com.kongregate.android.games.angrybots.t03_hard" };
            GoogleIAB.queryInventory(skus);
        };
        GoogleIABManager.queryInventorySucceededEvent += (purchases, skus) => {
            foreach (GooglePurchase purchase in purchases)
            {
                verifyGoogleReceipt(purchase);
            }
        };
        GoogleIABManager.purchaseSucceededEvent += purchase => {
            Debug.Log("Google IAB callback - purchased product: " + purchase);
            verifyGoogleReceipt(purchase);
        };
        GoogleIABManager.purchaseFailedEvent += message => {
            Debug.Log("Google IAB callback - purchase failed: " + message);
            KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL,
                                                            message, getPurchaseFields());
            mPurchaseReady = true;
        };
        GoogleIABManager.consumePurchaseSucceededEvent += purchase => {
            Debug.Log("Google IAB callback - consume succeeded: " + purchase);
        };
        GoogleIABManager.consumePurchaseFailedEvent += message => {
            Debug.Log("Google IAB callback - consume failed: " + message);
        };
        GoogleIAB.init(GetGooglePublicKey());
#else
        mPurchaseReady = true;
#endif
    }
コード例 #24
0
    void OnGUI()
    {
        float yPos  = 10.0f;
        float xPos  = 20.0f;
        float width = 210.0f;

        if (GUI.Button(new Rect(xPos, yPos, width, 40), "Get Can Make Payments"))
        {
            bool canMakePayments = StoreKitBinding.canMakePayments();
            Debug.Log("StoreKit canMakePayments: " + canMakePayments);
        }


        if (GUI.Button(new Rect(xPos, yPos += 50, width, 40), "Get Product Data"))
        {
            // comma delimited list of product ID's from iTunesConnect.  MUST match exactly what you have there!
            string productIdentifiers = "anotherProduct,tt,testProduct,sevenDays,oneMonthSubsciber";
            StoreKitBinding.requestProductData(productIdentifiers);
        }


        if (GUI.Button(new Rect(xPos, yPos += 50, width, 40), "Restore Completed Transactions"))
        {
            StoreKitBinding.restoreCompletedTransactions();
        }


        if (GUI.Button(new Rect(xPos, yPos += 50, width, 40), "Validate Receipt"))
        {
            // grab the transactions, then just validate the first one
            List <StoreKitTransaction> transactionList = StoreKitBinding.getAllSavedTransactions();
            if (transactionList.Count > 0)
            {
                StoreKitBinding.validateReceipt(transactionList[0].base64EncodedTransactionReceipt, true);
            }
        }

        // Second column
        xPos += xPos + width;
        yPos  = 10.0f;
        if (GUI.Button(new Rect(xPos, yPos, width, 40), "Purchase Product 1"))
        {
            StoreKitBinding.purchaseProduct("testProduct", 1);
        }


        if (GUI.Button(new Rect(xPos, yPos += 50, width, 40), "Purchase Product 2"))
        {
            StoreKitBinding.purchaseProduct("anotherProduct", 1);
        }


        if (GUI.Button(new Rect(xPos, yPos += 50, width, 40), "Purchase Subscription"))
        {
            StoreKitBinding.purchaseProduct("sevenDays", 1);
        }


        if (GUI.Button(new Rect(xPos, yPos += 50, width, 40), "Validate Subscription"))
        {
            // grab the transactions and if we have a subscription in there validate it
            List <StoreKitTransaction> transactionList = StoreKitBinding.getAllSavedTransactions();
            foreach (var t in transactionList)
            {
                if (t.productIdentifier == "sevenDays")
                {
                    StoreKitBinding.validateAutoRenewableReceipt(t.base64EncodedTransactionReceipt, "YOUR_SECRET_FROM_ITC", true);
                    break;
                }
            }
        }


        if (GUI.Button(new Rect(xPos, yPos += 50, width, 40), "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");
            }
        }
    }
コード例 #25
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();
    }
コード例 #26
0
    public List <StoreKitTransaction> storekitTracs             = new List <StoreKitTransaction>();             // 소모되지 않아 다시 소모 처리 시도된 상품
#endif



    //결제 관련 정보위해 초기화
    public void Init_Payment()
    {
        ////상품이름이 없으면 초기화 진행하자
        if (Dic_productIDs == null)
        {
            Dic_productIDs = new Dictionary <ushort, string>()
            {
                { 201, "com.cle.dy.suddenground.gem_200" },
                { 202, "com.cle.dy.suddenground.gem_1000" },
                { 203, "com.cle.dy.suddenground.gem_2000" },
                { 204, "com.cle.dy.suddenground.gem_6000" },
                { 205, "com.cle.dy.suddenground.gem_12000" },
                { 301, "com.cle.dy.suddenground.cash_1" },
                { 302, "com.cle.dy.suddenground.cash_2" },
                { 303, "com.cle.dy.suddenground.cash_3" },
                { 304, "com.cle.dy.suddenground.cash_4" },
                { 305, "com.cle.dy.suddenground.cash_5" },
                { 306, "com.cle.dy.suddenground.cash_6" },
                { 307, "com.cle.dy.suddenground.cash_7" },
                { 308, "com.cle.dy.suddenground.cash_8" },
            };

            productIDs = new string[Dic_productIDs.Count];
            int idx = 0;
            foreach (var pId in Dic_productIDs)
            {
                productIDs[idx] = pId.Value;
                idx++;
            }

            //productIDs = new string[] { "com.cle.dy.suddenground.gem_200", "com.cle.dy.suddenground.gem_1000","com.cle.dy.suddenground.gem_2000"
            //,"com.cle.dy.suddenground.gem_6000","com.cle.dy.suddenground.gem_12000", "com.cle.dy.suddenground.cash_1",
            //"com.cle.dy.suddenground.cash_2","com.cle.dy.suddenground.cash_3",/*"com.cle.dy.suddenground.cash_4",*/"com.cle.dy.suddenground.cash_5"};



            //int _productCount = productIDs.Length;
            //int idx = 0;
            //
            //foreach (var shopItem in TableDataManager.instance.Infos_shops)
            //{
            //	if (idx < _productCount)
            //	{
            //		if (shopItem.Value.ShopIdx / 100 == 2 || shopItem.Value.ShopIdx / 100 == 3 || shopItem.Value.ShopIdx / 100 == 4) //상품인덱스가 200 번대 이거나 300번대 이거나 400번대
            //		{
            //			Dic_productIDs[shopItem.Value.ShopIdx] = productIDs[idx];
            //			idx++;
            //		}
            //
            //	}
            //}

            Debug.Log("초기화~~~~~~~~~~~~~Dic_productIDs");
            Prime31.Utils.logObject(Dic_productIDs);

            //에디터는 IsGetQueryInventory 값 true
#if UNITY_EDITOR
            IsGetQueryInventory = true;
#endif


            //각 플랫폼별로 인앱결제초기화하기
#if UNITY_ANDROID
            //구글개발자 센터에서받은 어플리케이션 라이센스키 (구글콘솔개발자센터 -> 개발도구 -> 서비스및 API ->어플리케이션 라이센스키 )
            string key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqADPACKXd7+ygFtcAnh5wrpULFbK9cbPch2v0EOfzzsn1mOTJk3lFT432GKcFUpj01oGEha2bIt8e6YEFVgbYIIo3JRPYfrUMsqRGf82ItyGLwzZm2DNodnGJpRXvI0hqHrH0Z1aTpME6cgu9GrtbaqZ8t3pqZ38/w1nKUDfGzJ0FurS9zyWW+x7e4tTRnrBAxnQFk5OXmazW2LIT1+9vq9AI5ad6MntT7ZufubbTbbzX6kwzEUaiWRJQjZhCQzyq/MgsXCCgHTJ1GjzZZY2Zal9w/kX7s+z3T61ElT65zrz1rKBJRhFzp/CdGetrBFJvmYB3vfpxnIABu2EgF7jQQIDAQAB";
            GoogleIABManager.billingSupportedEvent        += billingSupportedEvent;
            GoogleIABManager.billingNotSupportedEvent     += billingNotSupportedEvent;
            GoogleIABManager.queryInventorySucceededEvent += queryInventorySucceededEvent;

            GoogleIABManager.queryInventoryFailedEvent += queryInventoryFailedEvent;

            GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += purchaseCompleteAwaitingVerificationEvent;

            //상품 구매 성공 콜백함수
            GoogleIABManager.purchaseSucceededEvent += purchaseSucceededEvent;
            //상품 구매 실패 콜백함수
            GoogleIABManager.purchaseFailedEvent += purchaseFailedEvent;

            //상품 컨슘(소모)처리 성공 콜백함수
            GoogleIABManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent;
            //상품 컨슘(소모)처리 실패 콜백함수
            GoogleIABManager.consumePurchaseFailedEvent += consumePurchaseFailedEvent;

            // 인앱결제 초기화
            GoogleIAB.init(key);
            UserEditor.Getsingleton.EditLog("안드로이드 인앱결제 초기화완료");
#elif UNITY_IOS
            UserEditor.Getsingleton.EditLog("IOS 인앱결제 초기화");

            StoreKitManager.transactionUpdatedEvent += transactionUpdatedEvent;
            StoreKitManager.productPurchaseAwaitingConfirmationEvent += productPurchaseAwaitingConfirmationEvent;
            StoreKitManager.purchaseSuccessfulEvent           += purchaseSuccessfulEvent;
            StoreKitManager.purchaseCancelledEvent            += purchaseCancelledEvent;
            StoreKitManager.purchaseFailedEvent               += purchaseFailedEvent;
            StoreKitManager.productListReceivedEvent          += productListReceivedEvent;
            StoreKitManager.productListRequestFailedEvent     += productListRequestFailedEvent;
            StoreKitManager.restoreTransactionsFailedEvent    += restoreTransactionsFailedEvent;
            StoreKitManager.restoreTransactionsFinishedEvent  += restoreTransactionsFinishedEvent;
            StoreKitManager.paymentQueueUpdatedDownloadsEvent += paymentQueueUpdatedDownloadsEvent;

            StoreKitManager.productListReceivedEvent += allProducts =>
            {
                UserEditor.Getsingleton.EditLog("received total products: " + allProducts.Count);
                Products = allProducts;
            };

            //자동 컨슘처리 비활성화 -> 내가 컨슘처리할것이기 때문
            StoreKitManager.autoConfirmTransactions = false;

            StoreKitBinding.requestProductData(productIDs);
#endif
        }
    }
コード例 #27
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");
        }
    }