예제 #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 Initialize()
    {
        Debug.Log("begin...!");

        string unconfirmedProductID = StoreKitHelper.GetUnconfirmedProductID();

        //this.m_IsRequestProducts = false;

        if (unconfirmedProductID != null)
        {
            iOSConfirmContext confirmContext = new iOSConfirmContext();
            this.ChangeContext(confirmContext);
            confirmContext.StartProductConfirm(unconfirmedProductID);
            this.State = ShopActionState.Operating;
        }
        else
        {
            this.ChangeContext(new iOSIdleContext());
            this.State = ShopActionState.Idle;
        }
    }