コード例 #1
0
        public bool HavePurchasedUnlimitedThrow(string productId)
        {
            //from local
            //need not by user appleId, need not to be so strict
            if (1 == GamePrefs.GetSingleton().localPalyerPrefs.GetInt(GetProductBoughtPrefKey(productId)))
            {
                return(true);
            }

            if (!IsInitialized())
            {
                Log.Error("store have not inited yet.");

                return(false);
            }

            Product product = m_StoreController.products.WithID(productId);

            if (null == product)
            {
                Log.Error("can not found product " + productId);

                return(false);
            }

            return(product.hasReceipt);
        }
コード例 #2
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            // A consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, Constants.store_savetheegg_noads, StringComparison.Ordinal))
            {
                //store local
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));                  // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
                if (args.purchasedProduct.hasReceipt)
                {
                    GamePrefs.GetSingleton().localPalyerPrefs.SetInt(GetProductBoughtPrefKey(Constants.store_savetheegg_noads), 1);
                }
            }
            // Or ... an unknown product has been purchased by this user. Fill in additional products here....
            else
            {
                Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
            }

            // Return a flag indicating whether this product has completely been received, or if the application needs
            // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
            // saving purchased products to the cloud, and when that save is delayed.
            return(PurchaseProcessingResult.Complete);
        }
コード例 #3
0
 public void DebugClean()
 {
     _boughtNoAds = false;
     GamePrefs.GetSingleton().localPalyerPrefs.SetInt(GetProductBoughtPrefKey(Constants.store_savetheegg_noads), 0);
 }