Exemple #1
0
        /// <summary>
        /// 收据验证事件委托.
        /// </summary>
        /// <param name="iSelf">自身Action.</param>
        /// <param name="iTransactionID">交易ID.</param>
        /// <param name="iOK">OK标志位.</param>
        public void OnResponsedReceiptVerify(
            ResponseDataBase iResponseData)
        {
            if (null == iResponseData)
            {
                return;
            }
            this.Info("OnResponsedReceiptVerify():{0}", iResponseData.ToString());
            T5 _response = iResponseData as T5;

            if (null == _response)
            {
                this.Error("OnResponsedReceiptVerify():The data of response is invalid!!!");
                return;
            }

            if (true == _response.isOK)
            {
                this.Info("OnResponsedReceiptVerify():TransactionID::{0}", _response.TransactionID);

                // 交易完成设置成闲置状态
                this.SwitchState(IAPState.Idled);
            }
            else
            {
                // 设置错误消息
                this.SetErrorInfoByStatus(_response);
            }

            // 结束交易
            this.UToIAPFinalizeTransaction(_response);
        }
Exemple #2
0
        /// <summary>
        /// 订单回复回调事件委托.
        /// </summary>
        /// <param name="iResponseData">回复数据.</param>
        protected void OnResponsedOrdered(
            ResponseDataBase iResponseData)
        {
            if (iResponseData == null)
            {
                this.Error("OnResponsedOrdered():The data of response is null!!");
                return;
            }
            this.Info("OnResponsedOrdered():{0}", iResponseData.ToString());

            if (true == iResponseData.isOK)
            {
                T3 _response = iResponseData as T3;
                if (null == _response)
                {
                    this.Error("OnResponsedOrdered():The data of response is invalid!!!");
                    return;
                }
                this.ActiveOrderID = _response.OrderID;
                this.Info("OnResponsedOrdered():ActiveOrderID::{0}", this.ActiveOrderID);
                this.SwitchState(IAPState.Runing);

                if (null != this._IAPInstance)
                {
                    // 开始计时
                    if (null != this._timeCounter)
                    {
                        this._timeCounter.RestartCounter();
                    }
                    this._IAPInstance.StartTransaction(
                        _response.ProductID, _response.Quantity);
                }
            }
            else
            {
                // 设置错误消息
                this.SetErrorInfoByStatus(iResponseData);
            }
        }