Пример #1
0
    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);
            }
        }
    }
Пример #2
0
    public override void Execute()
    {
        PurchaseState purchaseState = StoreKitHelper.GetPurchaseState();

        Debug.Log("the state is : " + purchaseState.ToString());

        /*
         * if(purchaseState == PurchaseState.PurchasePurchasing)
         * {
         *      NetWorkDialog.Instance.HideConnectingWithoutManager();
         * }
         */
        if (purchaseState == PurchaseState.PurchaseSuccess)
        {
            ConfirmingContext confirmingContext = new ConfirmingContext()
            {
                ProductID = this.ProductID
            };
            this.ShopModule.ChangeContext(confirmingContext);
        }
        else if (purchaseState == PurchaseState.PurchaseFail || purchaseState == PurchaseState.PurchaseCancel)
        {
            IdleContext idleContext = new IdleContext();
            this.ShopModule.ChangeContext(idleContext);
            if (purchaseState == PurchaseState.PurchaseFail)
            {
                this.ShopModule.State = ShopActionState.Fail;
                //this.ShopModule.OnPurchaseFailed(PurchaseFailedReason.Abort);
            }
            else
            {
                this.ShopModule.State = ShopActionState.Cancel;
                //this.ShopModule.OnPurchaseFailed(PurchaseFailedReason.Cancel);
            }
        }
    }