Exemplo n.º 1
0
 public override void Execute()
 {
     if (StoreKitHelper.GetRequestState() == RequestProductState.RequestSuccess)
     {
         List <ShopItemInformation> products = this.ConstructShopItemInformation();
         if (products == null)
         {
             this.OnRequestFail();
         }
         else
         {
             if (this.SuccessorContext != null)
             {
                 this.ShopModule.ChangeContext(this.SuccessorContext);
             }
             else
             {
                 this.ShopModule.State = ShopActionState.Idle;
                 IdleContext idleContext = new IdleContext();
                 this.ShopModule.ChangeContext(idleContext);
             }
             this.ShopModule.OnRequestSuccessed(products);
         }
     }
     else if (StoreKitHelper.GetRequestState() == RequestProductState.RequestFail)
     {
         this.OnRequestFail();
     }
 }
Exemplo n.º 2
0
    private void OnRequestFail()
    {
        this.ShopModule.State = ShopActionState.Fail;
        IdleContext idleContext = new IdleContext();

        this.ShopModule.ChangeContext(idleContext);
        this.ShopModule.OnRequestFailed(string.Empty);
    }
Exemplo n.º 3
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);
            }
        }
    }