Пример #1
0
    // void SendBugReport(ReportBugRequest _request)
    // {
    //  mCurRequestSerialId++; if (mCurRequestSerialId == int.MaxValue) mCurRequestSerialId = 1;
    //  _request.serialId = mCurRequestSerialId;

    //  if (mReportBugHttpConnect == null)
    //  {
    //      mReportBugHttpConnect = new CombinedHttpConnect();
    //  }
    //  else
    //  {
    //      mReportBugHttpConnect.Release();
    //  }

    //  List<NetRequest> requests = new List<NetRequest>();
    //  requests.Add(_request);
    //  mReportBugHttpConnect.Initial(requests, int.MaxValue);
    //  mReportBugHttpConnect.Connect();
    // }


    void HandlerSpecialHttpConnect()
    {
        if (mReportBugHttpConnect != null)
        {
            if (mReportBugHttpConnect.IsGotResponse())
            {
                mReportBugHttpConnect.Release();
                mReportBugHttpConnect = null;
            }
        }
        // if (mUploadReplayHttpConnect != null)
        // {
        //  if (mUploadReplayHttpConnect.IsGotResponse())
        //  {
        //      mUploadReplayHttpConnect.Release();
        //      mUploadReplayHttpConnect = null;
        //  }
        // }
    }
Пример #2
0
    void CheckCurrentCombinedConnectStatus()
    {
        if (mCombinedHttpConnect != null)
        {
            // if request got response, handler the response and refresh requests list
            if (mCombinedHttpConnect.IsGotResponse())
            {
                bool result = mCombinedHttpConnect.ParseResponse();
                mCombinedHttpConnect.Release();

                if (NETWORK_CAL_RESPONDING_TIME)
                {
                    mRespondTime = mCurTime - mConnectTime;
                    if (mRespondTime > mMaxRespondTime)
                    {
                        mMaxRespondTime = mRespondTime;
                    }
                }
                //RefreshAllRequests();

                if (result)
                {
                    mState = EState.Idle;
                    if (mRetryCombineTimes > 0)
                    {
                        // if (IsIPStyle(mCombinedHttpConnect.GetGameServerURL()))
                        //     NetworkDefine.RegroupURLWithIPFirst();
                        // else
                        //     NetworkDefine.RegroupURLWithURLFirst();
                    }
                    mRetryCombineTimes = 0;
                }
                else
                {
                    // if (mErrorCode == 201 && mRetryCombineTimes < NetworkDefine.sMaxRetryTime)
                    // {
                    //  mRetryCombineTimes++;
                    //  mState = EState.Idle;

                    //                    mWaitingDialog = true;
                    //                    // Debug.LogError("retry 333");
                    //                    MessageBox.instance.ShowReconnecting(true);
                    //                    DebugUtils.LogNetwork("Retry "+mRetryCombineTimes);
                    // }
                    // else
                    // {
                    //  string title = TextManager.GetInstance().GetText(Text.NET_ERROR);
                    //  string str;

                    //  if (mErrorCode == 201)
                    //  {
                    //      str = TextManager.GetInstance().GetText(Text.NO_NETWORK_CONNECTION);
                    //  }
                    //  // special error for invalid session
                    //  else if (mErrorCode == 69000001)
                    //  {
                    //      str = TextManager.GetInstance().GetText(Text.LOGIN_SESSION_OUT_OF_DATE);
                    //  }
                    //  // special error string for attacking online or shield players
                    //  else if (mErrorCode == 1009012 || mErrorCode == 1009014)
                    //  {
                    //      title = TextManager.GetInstance().GetText(Text.WARN);
                    //      if (mErrorCode == 1009012)
                    //      {
                    //          str = TextManager.GetInstance().GetText(Text.BATTLE_PLAYER_ONLINE);
                    //      }
                    //      else
                    //      {
                    //          str = TextManager.GetInstance().GetText(Text.BATTLE_PLAYER_IN_SHIELD);
                    //      }
                    //  }
                    //  else
                    //  {
                    //      str = TextManager.GetInstance().GetText(Text.NET_RESPONSE_DATA_ERROR);
                    //      str += " "+mErrorRequestSerialId+", cmd:"+mErrorCommandId + ", code:"+mErrorCode;
                    //  }
                    //  MessageBox.instance.CloseWaitingDialog();


                    //  if (mErrorCode == 10001002 || mErrorCode == 10001003 || mErrorCode == 10001004 || mErrorCode == 10001005 || mErrorCode == 10001006 || mErrorCode == 10001009)
                    //  {
                    //      CommonDataManager.RequestGetResource();
                    //      title = TextManager.GetInstance().GetText(Text.WARN);
                    //      string StrWarning = TextManager.GetInstance().GetText(Text.Resource_Error_Warning);
                    //      MessageBox.instance.OpenMessageBox(MessageBox.eStyle.OK, title, StrWarning, null, null);
                    //      return;
                    //  }
                    //  MessageBox.instance.OpenLiveMessageBox(MessageBox.eStyle.NoButton, title, str, handler_error_release, null);
                    //  mState = EState.DataError;
                    //  mHasReportedError = false;
                    //  Clear();
                    // }
                }
            }
            else
            {
                // Debug.LogError("mCurTime " + mCurTime);
                // Debug.LogError("mConnectTime " + mConnectTime);
                // Debug.LogError("NetworkDefine.sConnectTimeout " + NetworkDefine.sConnectTimeout);
                if (mCurTime - mConnectTime > NetworkDefine.sConnectTimeout)
                {
                    mCurTime = mConnectTime + NetworkDefine.sConnectTimeout + 1f;
                    // Debug.LogError("2mCurTime " + mCurTime);
                    // Debug.LogError("2mConnectTime " + mConnectTime);
                    // Debug.LogError("2NetworkDefine.sConnectTimeout " + NetworkDefine.sConnectTimeout);
                    if (NETWORK_CAL_RESPONDING_TIME)
                    {
                        mRespondTime = mCurTime - mConnectTime;
                        if (mRespondTime > mMaxRespondTime)
                        {
                            mMaxRespondTime = mRespondTime;
                        }
                    }

                    mCombinedHttpConnect.Release();

                    if (mRetryCombineTimes < NetworkDefine.sMaxRetryTime)
                    {
                        // Debug.LogError("mRetryCombineTimes " + mRetryCombineTimes);
                        // Debug.LogError("NetworkDefine.sMaxRetryTime " + NetworkDefine.sMaxRetryTime);
                        mRetryCombineTimes++;
                        mState = EState.Idle;

                        mWaitingDialog = true;
                        // MessageBox.instance.ShowReconnecting(true);

                        Debug.Log("Retry " + mRetryCombineTimes);
                    }
                    else
                    {
                        // // Debug.LogError("retry times out");
                        // string title = TextManager.GetInstance().GetText(Text.NET_ERROR);
                        // string str = TextManager.GetInstance().GetText(Text.NO_NETWORK_CONNECTION);
                        // MessageBox.instance.CloseWaitingDialog();
                        // MessageBox.instance.OpenLiveMessageBox(MessageBox.eStyle.NoButton, title, str, handler_error_release, null);
                        mState = EState.Timeout;
                        Clear();
                    }
                }
            }
        }
        else
        {
            mState = EState.Idle;
        }
    }