/// <summary>
        /// Get方法访问服务器
        /// </summary>
        /// <param name="httpUrl">服务器地址</param>
        /// <param name="callBack">回调函数</param>
        /// <param name="Coerce">关闭之前的协程,强制执行新请求</param>
        /// <param name="HttpGetType">请求类型</param>
        /// <param name="parameters">回调携带的参数</param>
        public void Get(string httpUrl, HttpCallBack callBack = null, bool Coerce = false, HttpGetType type = HttpGetType.normal, object[] parameters = null)
        {
//#if UNITY_EDITOR
//            if (!InitBaseData(httpUrl, callBack, parameters)) return;
//            m_HttpGetType = type;
//            m_IsCanNext = true;
//            EditorCoroutineLooper.StartLoop(m_CoroutinesMono, HttpCoroutines());
//            return;
//#endif
            if (Coerce == true)
            {
                m_CoroutinesMono.StopCoroutine(m_Coroutine);
                m_Coroutine = null;
            }
            if (m_Coroutine == null)
            {
                if (!InitBaseData(httpUrl, callBack, parameters))
                {
                    return;
                }
                m_HttpGetType = type;
                m_IsCanNext   = true;
                m_Coroutine   = m_CoroutinesMono.StartCoroutine(HttpCoroutines());
            }
            else
            {
                WDebuger.Log("上一个请求尚未完成,请稍等");
            }
        }
        /// <summary>
        /// Post方法将资源上传到服务器,资源类型字节数组
        /// </summary>
        /// <param name="httpUrl">服务器地址</param>
        /// <param name="postData">资源字节数组</param>
        /// <param name="callBack">回调函数</param>
        /// <param name="Corece">关闭之前的协程,强制执行新请求</param>
        /// <param name="parameters">回调携带的参数</param>
        public void Post(string httpUrl, byte[] postData, string fileName = "data", HttpCallBack callBack = null, bool Corece = false, object[] parameters = null)
        {
//#if UNITY_EDITOR
//            if (!InitBaseData(httpUrl, callBack, parameters)) return;
//            m_IsCanNext = true;
//            m_PostData = postData;
//            m_DataName = fileName;
//            EditorCoroutineLooper.StartLoop(m_CoroutinesMono, HttpCoroutines());
//            return;
//#endif
            if (Corece == true)
            {
                m_CoroutinesMono.StopCoroutine(m_Coroutine);
                m_Coroutine = null;
            }
            if (m_Coroutine == null)
            {
                if (!InitBaseData(httpUrl, callBack, parameters))
                {
                    return;
                }
                m_PostData  = postData;
                m_DataName  = fileName;
                m_Coroutine = m_CoroutinesMono.StartCoroutine(HttpCoroutines());
            }
            else
            {
                WDebuger.Log("上一个请求尚未完成,请稍等");
            }
        }
 /// <summary>
 /// 单个文件上传完成回调
 /// </summary>
 /// <param name="over"></param>
 /// <param name="msg"></param>
 private static void UpVideoCallBack(bool over, string msg)
 {
     if (over == false)
     {
         m_ReturnoMsg = "failure";
         WDebuger.LogError("文件上传失败,请检查! 消息:" + msg);
         //EditorUtility.ClearProgressBar();
         //if (ChinarMessage.ShowRetryCancel("文件上传失败,请检查! 消息:" + msg, "警告"))
         UpToServer();
         return;
     }
     WDebuger.Log("文件上传成功!文件名:" + m_ResFileName[m_ItemResFilePath[0]]);
     m_ReturnoMsg = "over";
     m_ResServerPath.Add(m_ResFileName[m_ItemResFilePath[0]], msg);
     m_ItemResFilePath.RemoveAt(0);
     if (m_ItemResFilePath.Count <= 0)
     {
         m_UploadConfig = true;
         return;
     }
     try
     {
         string itemResPath      = m_ItemResFilePath[0];
         string itemResCloudName = m_ResFileName[m_ItemResFilePath[0]];
         WillAliyunUpload.Instance.UploadData(itemResPath, ConstData.companyname, ConstData.projectname + "/" + itemResCloudName, UpVideoCallBack, UploadProgressChangedEvent);
     }
     catch (Exception e)
     {
         WDebuger.LogError("文件上传失败,请检查! 消息:" + e.Message);
         //EditorUtility.ClearProgressBar();
         //if (ChinarMessage.ShowRetryCancel("文件上传失败,请检查! 消息:" + msg, "警告"))
         UpToServer();
         throw;
     }
 }
 private static void UpOver()
 {
     m_AllUploadOver = false;
     WDebuger.Log("文件上传成功!文件名:" + m_ConfigFileName);
     //ChinarMessage.ShowOK("上传完成!上传文件数量:" + (m_ResFilePath.Count + 1), "完成消息");
     WDebuger.Log("上传完成!上传文件数量:" + (m_ResFilePath.Count + 1));
     //EditorUtility.ClearProgressBar();
     //m_Window.Close();
 }
 /// <summary>
 /// 单个下载回调
 /// 会继续执行后面的下载
 /// 加载完成会调用回调
 /// </summary>
 /// <param name="ftpHost"></param>
 /// <param name="downloadSucceed"></param>
 /// <param name="callBackMessage"></param>
 /// <param name="downloadData"></param>
 /// <param name="e"></param>
 private void DownloadFileCallBack(string ftpHost, bool downloadSucceed, string callBackMessage, byte[] downloadData, DownloadDataCompletedEventArgs e)
 {
     if (downloadSucceed == false)
     {
         WDebuger.LogError("下载失败,请检查网络!");
         m_CallBack(false, "下载失败,请检查网络!", m_Parameters);
         m_CanChack = true;
         return;
     }
     WDebuger.Log("文件下载成功!:[" + ftpHost + "]");
     m_Coroutine = m_CoroutinesMono.StartCoroutine(SaveFile(downloadData));
 }
 /// <summary>
 /// 检查更新回调
 /// </summary>
 /// <param name="overOrFailed"></param>
 /// <param name="message"></param>
 /// <param name="parameters"></param>
 private void UpdataResCallBack(bool overOrFailed, string message, object[] parameters = null)
 {
     WDebuger.Log(message);
     if (overOrFailed == true)
     {
         m_CallBack(true, "下载完成", m_Parameters);
         Destroy(gameObject);
     }
     else
     {
         m_CallBack(false, message, m_Parameters);
         WDebuger.LogError("错误");
     }
 }
 //下载完成
 private void OnDataUploadCompleted(object sender, DownloadDataCompletedEventArgs e)
 {
     m_DownloadOver = true;
     WDebuger.Log(m_FTPHost);
     if (e.Error != null)
     {
         m_DownloadSucceed = false;
         m_FtpDownloadCallBack?.Invoke(m_FTPHost, m_DownloadSucceed, e.Error.Message, null, e);
     }
     else
     {
         m_DownloadSucceed = true;
         m_FtpDownloadCallBack?.Invoke(m_FTPHost, m_DownloadSucceed, "Succeed", e.Result, e);
     }
 }
        /// <summary>
        /// 通过ftp从服务器下载资源
        /// </summary>
        /// <param name="downloadHost">ftp地址</param>
        /// <param name="callBack">完成回调函数</param>
        /// <param name="progress">进度改变回调函数</param>
        public void DownLoadData(string downloadHost, WillFtpDownloadCallBack callBack, WillFtpDownloadProgressChangerEvent progress = null)
        {
            if (string.IsNullOrEmpty(downloadHost))
            {
                WDebuger.Log("ftp地址为空,请检查! 参数:" + downloadHost);
                return;
            }
            m_FTPHost               = downloadHost;
            m_FtpDownloadCallBack   = callBack;
            m_DownloadProgressEvent = progress;
            m_Progreess             = 0;
            m_DownloadData          = null;
            m_DownloadSucceed       = false;
            m_DownloadOver          = false;
            m_WebClient             = new WebClient();
            Uri uri = new Uri(downloadHost);

            m_WebClient.DownloadDataCompleted   += new DownloadDataCompletedEventHandler(OnDataUploadCompleted);
            m_WebClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(OnDownloadDataProgressChanged);
            m_WebClient.Credentials              = new NetworkCredential(m_FTPUserName, m_FTPPasswork);

            m_WebClient.DownloadDataAsync(uri);
        }
        private IEnumerator SaveFile(byte[] file)
        {
            WDebuger.Log(m_DownLoadFileNameItem[0]);
            m_DownloadMessage = "保存文件中";
            if (!Directory.Exists(m_SavePath))
            {
                Directory.CreateDirectory(m_SavePath);
            }
            FileInfo fileInfo = new FileInfo(m_SavePath + m_DownLoadFileNameItem[0]);

            if (fileInfo.Exists)
            {
                fileInfo.Delete();
            }

            Stream sw = fileInfo.Create();

            yield return(sw.WriteAsync(file, 0, file.Length));

            yield return(null);

            sw.Flush();
            sw.Close();
            sw.Dispose();
            m_DownLoadFileNameItem.RemoveAt(0);

            if (m_DownLoadFileNameItem.Count <= 0)//所有资源加载完成
            {
                UpdateConfig();
            }
            else
            {
                m_DownloadProgress = (m_DownLoadFileName.Count - m_DownLoadFileNameItem.Count) / m_DownLoadFileName.Count;
                DownLoadFile();
            }
        }