Exemplo n.º 1
0
 /// <summary>
 /// DELETE 返回空数据
 /// </summary>
 /// <param name="url"></param>
 /// <param name="headers"></param>
 /// <param name="callback"></param>
 /// <param name="progress"></param>
 public static void DeleteNone(string url, Dictionary <string, string> headers = null,
                               Action <string, long, object[]> callbacknone    = null, Action <float> progress = null, params object[] args)
 {
     if (NetEventTmpSave.HasEventNone(NetEventTmpSave.EventType.DELETE, url))
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.DELETE, url, callbacknone);
     }
     else
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.DELETE, url, callbacknone);
         Action <string, long, object[]> callback = (uurl, code, aargs) =>
         {
             NetEventTmpSave.Invoke(NetEventTmpSave.EventType.DELETE, uurl, code, aargs);
         };
         NetDeleteRequest request = NetDeleteRequest.Allocate(url, headers, callback, progress, args);
         Instance.StartCoroutine(request.IEnumStart());
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 分配一个实例空间,并开启请求
 /// </summary>
 /// <param name="url"></param>
 /// <param name="postDataByteArr"></param>
 /// <param name="headers"></param>
 /// <param name="callback"></param>
 /// <param name="progress"></param>
 /// <param name="args"></param>
 public static void Post(string url, byte[] postDataByteArr, Dictionary <string, string> headers = null,
                         Action <string, long, object[]> callback = null, Action <float> progress = null, params object[] args)
 {
     if (NetEventTmpSave.HasEventNone(NetEventTmpSave.EventType.POST, url))
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.POST, url, callback);
     }
     else
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.POST, url, callback);
         Action <string, long, object[]> callbackt = (uurl, code, aargs) =>
         {
             NetEventTmpSave.Invoke(NetEventTmpSave.EventType.POST, uurl, code, aargs);
         };
         NetPostRequest request = NetPostRequest.Allocate(url, postDataByteArr, headers, callbackt, progress, args);
         Instance.StartCoroutine(request.IEnumStart());
     }
 }