private void ReadFromStorage(IAPProductsStorage storage) { for (int i = 0; i < storage.IAPProducts.Count; i++) { var iapProductData = storage.IAPProducts[i]; var iapProduct = IAPProduct.CreateIapProductByData(iapProductData); AddProduct(iapProduct); } }
public void RemoveProduct(IAPProduct product) { if (product == null) { return; } iapProducts.Remove(product.ProductKey); }
public void BuyProduct(IAPProduct iapProduct) { var product = storeController.products.WithID(iapProduct.ProductKey); if (product != null && product.availableToPurchase) { storeController.InitiatePurchase(product); } }
public void AddProduct(IAPProduct product) { if (product == null) { return; } if (!iapProducts.ContainsKey(product.ProductKey)) { iapProducts.Add(product.ProductKey, product); } }
public static IAPProduct CreateIapProductByData(IAPProductData data) { var iapProduct = new IAPProduct() { ProductKey = data.productKey, StoreKey = data.storeKey, Price = data.price, ProductType = data.productType, GPProductKey = data.gpProductKey, IOSProductKey = data.iosProductKey }; iapProduct.Init(); return(iapProduct); }
public void OnPurchaseError(IAPProduct product) { EventManager.Call <IIAPHandler>(x => x.ResultTransaction(product, TransactionResult.ERROR)); }
public void OnPurchaseCanceled(IAPProduct product) { EventManager.Call <IIAPHandler>(x => x.ResultTransaction(product, TransactionResult.CANCEL)); }
public void OnPurchasePending(IAPProduct product) { EventManager.Call <IIAPHandler>(x => x.ResultTransaction(product, TransactionResult.PENDING)); }
public void OnPurchaseAuthorized(IAPProduct product) { EventManager.Call <IIAPHandler>(x => x.ResultTransaction(product, TransactionResult.AUTHORIZED)); }
public void BuyProduct(IAPProduct product) { Store.BuyProduct(product); EventManager.Call <IIAPHandler>(x => x.SendTransaction(product)); }
public void ConfirmPurchase(IAPProduct product) { storeController.ConfirmPendingPurchase(product.Product); }