Example #1
0
 /// <summary>
 /// Get additional info for subscription
 /// </summary>
 /// <param name="product">the subscription product</param>
 /// <returns>all infos available for the subscription</returns>
 public SubscriptionInfo GetSubscriptionInfo(ShopProductNames product)
 {
     if (IsInitialized())
     {
         return(shopProducts.First(cond => String.Equals(cond.productName, product.ToString())).subscriptionInfo);
     }
     else
     {
         Debug.LogError("Not Initialized -> Call IAPManager.Instance.InitializeIAPManager() before anything else");
         return(null);
     }
 }
Example #2
0
 /// <summary>
 /// Gets the status of the product
 /// </summary>
 /// <param name="product"></param>
 /// <returns>true if the product was already bought</returns>
 public bool IsActive(ShopProductNames product)
 {
     if (IsInitialized())
     {
         return(shopProducts.First(cond => String.Equals(cond.productName, product.ToString())).active);
     }
     else
     {
         Debug.LogError("Not Initialized -> Call IAPManager.Instance.InitializeIAPManager() before anything else");
         return(false);
     }
 }
Example #3
0
 /// <summary>
 /// Get title from the store
 /// </summary>
 /// <param name="product">store product</param>
 /// <returns></returns>
 public string GetLocalizedTitle(ShopProductNames product)
 {
     if (IsInitialized())
     {
         return(shopProducts.First(cond => String.Equals(cond.productName, product.ToString())).localizedTitle);
     }
     else
     {
         Debug.LogError("Not Initialized -> Call IAPManager.Instance.InitializeIAPManager() before anything else");
         return("-");
     }
 }
Example #4
0
    /// <summary>
    /// call this method to buy a product
    /// </summary>
    /// <param name="productName">An enum member generated from Settings Window</param>
    /// <param name="OnCompleteMethod">callback method that returns the bought product details for initializations</param>
    public void BuyProduct(ShopProductNames productName, UnityAction <IAPOperationStatus, string, StoreProduct> OnCompleteMethod)
    {
        if (debug)
        {
            Debug.Log(this + "Buy Process Started for " + productName);
            ScreenWriter.Write(this + "Buy Process Started for " + productName);
        }

        this.OnCompleteMethod = OnCompleteMethod;

        for (int i = 0; i < shopProducts.Count; i++)
        {
            if (shopProducts[i].productName == productName.ToString())
            {
                BuyProductID(shopProducts[i].GetStoreID());
            }
        }
    }
Example #5
0
 /// <summary>
 /// Get the price and currency code of the product as a string
 /// </summary>
 /// <param name="product">store product</param>
 /// <returns>the localized price and currency of the product</returns>
 public string GetLocalizedPriceString(ShopProductNames product)
 {
     if (IsInitialized())
     {
         if (shopProducts != null)
         {
             return(shopProducts.First(cond => String.Equals(cond.productName, product.ToString())).localizedPriceString);
         }
         else
         {
             Debug.LogError("No products available -> Go to Window->Gley->Easy IAP and define your products");
         }
     }
     else
     {
         Debug.LogError("Not Initialized -> Call IAPManager.Instance.InitializeIAPManager() before anything else");
     }
     return("-");
 }
Example #6
0
 public virtual void OnPurchaseButtonPressed()
 {
     AppMetricaManager.SendProductClick(_shopProductNames.ToString());
     _onClickPurchaseHandler?.Invoke(_shopProductNames);
 }