public override void Execute() { iOSShopUtility shopUtility = (iOSShopUtility)this.ShopModule; if (shopUtility.IsReceivedConfirmResponse) { if (string.IsNullOrEmpty(shopUtility.CurrentConfirmError)) { this.ChangeToNextContext(true); foreach (ShopItemInformation product in this.ShopModule.ShopItems) { if (this.m_ProductID.Equals(product.ProductID)) { this.ShopModule.OnPurchaseSuccessed(product); break; } } } else { this.ChangeToNextContext(false); PurchaseFailInformation failInformation = new PurchaseFailInformation(); failInformation.Reason = PurchaseFailedReason.ComfirmFail; failInformation.ErrorDescription = shopUtility.CurrentConfirmError; this.ShopModule.OnPurchaseFailed(failInformation); } } }
public override void Execute() { PurchaseState purchaseState = StoreKitHelper.GetPurchaseState(); Debug.Log("the state is : " + purchaseState.ToString()); if (purchaseState == PurchaseState.PurchaseSuccess) { iOSConfirmContext confirmContext = new iOSConfirmContext(); this.ShopModule.ChangeContext(confirmContext); confirmContext.StartProductConfirm(this.m_ProductID); } else if (purchaseState == PurchaseState.PurchaseFail || purchaseState == PurchaseState.PurchaseCancel) { iOSIdleContext idleContext = new iOSIdleContext(); this.ShopModule.ChangeContext(idleContext); if (purchaseState == PurchaseState.PurchaseFail) { this.ShopModule.State = ShopActionState.Fail; PurchaseFailInformation failInformation = new PurchaseFailInformation(); failInformation.Reason = PurchaseFailedReason.Abort; failInformation.ErrorDescription = ClientStringConstants.PURCHASE_FAIL_TIPS; this.ShopModule.OnPurchaseFailed(failInformation); } else { this.ShopModule.State = ShopActionState.Cancel; PurchaseFailInformation failInformation = new PurchaseFailInformation(); failInformation.Reason = PurchaseFailedReason.Cancel; failInformation.ErrorDescription = ClientStringConstants.PURCHASE_FAIL_TIPS; this.ShopModule.OnPurchaseFailed(failInformation); } } }
private void Fail() { this.ShopModule.State = ShopActionState.Fail; PurchaseFailInformation failInformation = new PurchaseFailInformation(); failInformation.Reason = PurchaseFailedReason.ComfirmFail; failInformation.ErrorDescription = NO_RECEIPT_ERROR_DESCRIPTION; this.ShopModule.OnPurchaseFailed(failInformation); this.ChangeToNextContext(false); }
public void OnPurchaseFailed(PurchaseFailInformation failInformation) { this.m_PurchaseFailedListeners.Invoke(failInformation); }