void DequeueQueryProducts() { while (m_ProductsToQuery.Count > 0) { ProductDescriptionQuery productDescriptionQuery = m_ProductsToQuery.Dequeue(); if (m_IsConnectedToGoogle) { m_QuerySkuDetailsService.QueryAsyncSku(productDescriptionQuery.products, productDescriptionQuery.onProductsReceived); } else if (m_HasConnectionAttempted) { productDescriptionQuery.onRetrieveProductsFailed(); } } }
public void Purchase(ProductDefinition product, Product oldProduct, int desiredProrationMode) { m_QuerySkuDetailsService.QueryAsyncSku(product, skus => { OnQuerySkuDetailsResponse(skus, product, oldProduct, desiredProrationMode); }); }
void DequeueQueryProducts() { var productsFailedToDequeue = new Queue <ProductDescriptionQuery>(); var stop = false; while (m_ProductsToQuery.Count > 0 && !stop) { switch (m_GoogleConnectionState) { case GoogleBillingConnectionState.Connected: { var productDescriptionQuery = m_ProductsToQuery.Dequeue(); m_QuerySkuDetailsService.QueryAsyncSku(productDescriptionQuery.products, productDescriptionQuery.onProductsReceived); break; } case GoogleBillingConnectionState.Disconnected: { var productDescriptionQuery = m_ProductsToQuery.Dequeue(); productDescriptionQuery.onRetrieveProductsFailed(); productsFailedToDequeue.Enqueue(productDescriptionQuery); break; } case GoogleBillingConnectionState.Connecting: { stop = true; break; } default: { Debug.LogErrorFormat("GooglePlayStoreService state ({0}) unrecognized, cannot process ProductDescriptionQuery", m_GoogleConnectionState); stop = true; break; } } } foreach (var product in productsFailedToDequeue) { m_ProductsToQuery.Enqueue(product); } }
public void PriceChange(ProductDefinition product, Action <IGoogleBillingResult> onPriceChangedListener) { m_QuerySkuDetailsService.QueryAsyncSku(product, skuDetailsList => { foreach (var skuDetails in skuDetailsList) { m_BillingClient.LaunchPriceChangeConfirmationFlow(skuDetails, new GooglePriceChangeConfirmationListener(onPriceChangedListener)); } }); }