コード例 #1
0
        public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
        {
            PurchaseFailed?.Invoke(product.definition.id, failureReason);
            SceneActivationBehaviour <GameLogicActivator> .Instance.AnalyticsController.SendPurchaseEvent(AnalyticsScripts.QLPurchaseState.QLPurchaseStateFailed,
                                                                                                          product.definition.id,
                                                                                                          (float)product.metadata.localizedPrice,
                                                                                                          product.metadata.isoCurrencyCode,
                                                                                                          SceneActivationBehaviour <StoreUIActivator> .Instance.CoinsForProduct(product.definition.id),
                                                                                                          SceneActivationBehaviour <StoreUIActivator> .Instance.StoreOpenSource);

            // A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing
            // this reason with the user to guide their troubleshooting actions.
            Debug.Log(string.Format("[IAP] OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
        }
コード例 #2
0
        private void InvokePurchaseFailed(PurchaseResult purchaseResult, StorePurchaseError failReason, Exception ex)
        {
            var product   = purchaseResult.TransactionInfo?.Product;
            var productId = _purchaseProductId ?? "null";

            _console.TraceEvent(TraceEventType.Error, _traceEventPurchase, $"{GetEventName(_traceEventPurchase)} error: {productId}, reason = {failReason}");

            if (_observers != null)
            {
                lock (_observers)
                {
                    foreach (var item in _observers)
                    {
                        try
                        {
                            item.OnNext(new PurchaseInfo(productId, purchaseResult, failReason, ex));
                        }
                        catch (Exception e)
                        {
                            _console.TraceData(TraceEventType.Error, _traceEventPurchase, e);
                        }
                    }
                }
            }

            try
            {
                PurchaseFailed?.Invoke(this, new PurchaseFailedEventArgs(productId, purchaseResult, failReason, ex));
            }
            catch (Exception e)
            {
                _console.TraceData(TraceEventType.Error, _traceEventPurchase, e);
            }
            finally
            {
                _console.TraceEvent(TraceEventType.Stop, _traceEventPurchase, GetEventName(_traceEventPurchase) + " failed: " + productId);
            }
        }
コード例 #3
0
 protected virtual void OnFailedP(Product product, PurchaseFailureReason failureReason)
 {
     PurchaseFailed?.Invoke(product, failureReason);
     Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
 }
コード例 #4
0
 public void NotifyPurchaseFailed()
 {
     PurchaseFailed?.Invoke(this, EventArgs.Empty);
 }
コード例 #5
0
 protected virtual void OnFailed(Product product, PurchaseFailureReason failureReason)
 {
     PurchaseFailed?.Invoke(product, failureReason);
     EventManager.Notify(this, new GameEventArgs(Events.IAPEvents.FAILED_BOUGHT, failureReason.ToString(), product));
     Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
 }
コード例 #6
0
 public void OnPurchaseFailed(Product i, PurchaseFailureReason p)
 {
     PurchaseFailed?.Invoke(i, p);
 }