コード例 #1
0
ファイル: Form1.cs プロジェクト: aamartin2k/Watchdog
        private void GetAll()
        {
            //RequestDataEvent req = new RequestDataEvent(RequestDataEvent.RequestType.All);
            RequestDataEvent req = new RequestDataEvent(RequestType.All);


            Out_GetAllData(req);
        }
コード例 #2
0
 /// <summary>
 /// 下载数据
 /// </summary>
 /// <param name="url">请求的链接</param>
 /// <param name="action">发生的事件</param>
 /// <param name="method">请求的方式</param>
 /// <returns></returns>
 public static bool DownloadData(string url, RequestDataEvent action, string method = UnityWebRequest.kHttpVerbGET)
 {
     if (IsNull(url, action, action.action))
     {
         return(true);
     }
     Instance.StartCoroutine(Instance.DownloadDataIEnumerator(url, method, action));
     return(false);
 }
コード例 #3
0
    IEnumerator DownloadDataIEnumerator(string url, string method, RequestDataEvent action)
    {
        var request = new UnityWebRequest(url, method);

        request.downloadHandler = new DownloadHandlerBuffer();
        if (action.downloadProgress != null)
        {
            StartCoroutine(DownloadProgress(request, action.downloadProgress));
        }
        yield return(request.SendWebRequest());

        Dispose(request, () =>
        {
            action.action(request.downloadHandler.data);
        }, action.error, action.error404, action.error500);
    }