Beispiel #1
0
        /// <summary>
        /// ���շ�������Ϣ
        /// </summary>
        /// <param name="respData"></param>
        public virtual void DoProcess(BaseDto dto)
        {
            JSONObject json = dto.resposeJSON;
            if (json.RecdHasKey(BaseConst.NOW_SERVER_TIME))
            {
                BaseData.preServerDateTime = BaseData.nowServerDateTime;
                DateTime preClientDateTime = BaseData.nowClientDateTime;
                BaseData.nowServerTime = json.GetRecd<string>(BaseConst.NOW_SERVER_TIME);
                BaseData.nowServerDateTime = CommonUtils.DateParse(BaseData.nowServerTime);
                BaseData.nowClientDateTime = DateTime.Now;
                double serverTotalSeconds = BaseData.nowServerDateTime.Subtract(BaseData.preServerDateTime).TotalSeconds;
                double clientTotalSeconds = BaseData.nowClientDateTime.Subtract(preClientDateTime).TotalSeconds;
                if (BaseData.initDateTime)
                {
                    double diffSeconds = Math.Abs(serverTotalSeconds - clientTotalSeconds);
                    if (diffSeconds > 3000)
                    {
                        // this.actionMgr.client.timeWrong = true;
                        // TODO �ͻ���������ʾ�رճ���
                        // this.actionMgr.client.DispatchEvent(YxEventType.TIME_WRONG, null);
                    }
                }
                else
                {
                    BaseData.startServerDateTime = BaseData.nowServerDateTime;
                    BaseData.preChkDayServerDateTime = BaseData.nowServerDateTime;
                }
                BaseData.initDateTime = true;
            }
            string retMsg = json.GetRecd<string>(BaseConst.RET_VAL);
            dto.retType = json.GetRecd<int>(BaseConst.RET_TYPE);
            switch (retMsg)
            {
                case BaseConst.RET_VAL_SUCC:
                    this.DoSuccess(dto);
                    break;
                case BaseConst.RET_VAL_FAIL:
                    this.DoFail(dto);
                    break;
                case BaseConst.RET_VAL_NATIVE:
                    this.DoNative(dto);
                    break;
                default:
                    break;
            }
            dto.ExecuteNetResponseCallback();
            dto.ExecuteUICallback();

            if (this.doProcessEnd != null)
            {
                this.client.DispatchToMainThread(this.doProcessEnd, dto);
            }
        }