Exemple #1
0
    private void OnRequestErrorHandle(BaseEvent e)
    {
        RequestErrorEvent evt = e as RequestErrorEvent;

        if (evt.type == RequestErrorEvent.Type.AnalysisError)
        {
            if (GameMainManager.instance.uiManager != null)
            {
                Alert.Show("数据解析错误");
                Waiting.Disable();
            }
        }
        else if (evt.type == RequestErrorEvent.Type.TimeOut)
        {
            Debug.Log(string.Format("请求失败:{0} 正在尝试重新请求", evt.request.State.ToString()));
            if (GameMainManager.instance.uiManager != null)
            {
                GameMainManager.instance.uiManager.isWaiting = false;
                Alert.Show("连接失败:" + evt.request.State.ToString(), Alert.OK | Alert.CANCEL, (isOK) => {
                    if (isOK == Alert.OK)
                    {
                        HttpProxy.SendRequest(evt.request);
                    }
                }, "重试");

                Waiting.Disable();
            }
            else
            {
                HttpProxy.SendRequest(evt.request);
            }
        }
        else
        {
            if (GameMainManager.instance.uiManager != null)
            {
                Debug.Log(string.Format("请求失败:{0} |{1}", evt.type.ToString(), evt.request.Uri));
                Waiting.Disable();
            }
        }
    }