コード例 #1
0
ファイル: iOSBuyContext.cs プロジェクト: KangLLL/century_war
    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
        /// <summary>
        /// Inserts a purchased product into the database. There may be multiple
        /// rows in the table for the same product if it was purchased multiple times
        /// or if it was refunded. </summary>
        /// <param name="orderId"> the order ID (matches the value in the product list) </param>
        /// <param name="productId"> the product ID (sku) </param>
        /// <param name="state"> the state of the purchase </param>
        /// <param name="purchaseTime"> the purchase time (in milliseconds since the epoch) </param>
        /// <param name="developerPayload"> the developer provided "payload" associated with
        ///     the order. </param>
        private void insertOrder(string orderId, string productId, PurchaseState state, long purchaseTime, string developerPayload)
        {
            ContentValues values = new ContentValues();

            values.Put(HISTORY_ORDER_ID_COL, orderId);
            values.Put(HISTORY_PRODUCT_ID_COL, productId);
            values.Put(HISTORY_STATE_COL, state.ToString());
            values.Put(HISTORY_PURCHASE_TIME_COL, purchaseTime);
            values.Put(HISTORY_DEVELOPER_PAYLOAD_COL, developerPayload);
            mDb.Replace(PURCHASE_HISTORY_TABLE_NAME, null, values); // nullColumnHack
        }
コード例 #3
0
ファイル: BuyingContext.cs プロジェクト: KangLLL/century_war
    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);
            }
        }
    }
コード例 #4
0
 public static new void RegisterInAppPurchase(PurchaseState purchaseState, string purchaseToken, string productId, string orderId, DateTime purchaseTime, string developerPayload, double price, string currency)
 {
     Debug.Log("FuseAPI:RegisterInAppPurchase(" + purchaseState.ToString() + "," + purchaseToken + "," + productId + "," + orderId + "," + DateTimeToTimestamp(purchaseTime) + "," + developerPayload + "," + price + "," + currency + ")");
     _fuseUnityPlugin.CallStatic("registerInAppPurchase", purchaseState.ToString(), purchaseToken, productId, orderId, DateTimeToTimestamp(purchaseTime), developerPayload, price, currency);
 }
コード例 #5
0
 public ICursor queryTransactions(String productId, PurchaseState state)
 {
     return(mDb.Query(TABLE_TRANSACTIONS, TABLE_TRANSACTIONS_COLUMNS, COLUMN_PRODUCT_ID + " = ? AND " + COLUMN_STATE + " = ?",
                      new String[] { productId, Convert.ToString(state.ToString()) }, null, null, null));
 }