public void OpenRequest(int id, string url, string method, string head, string body = null, string contentType = null, int timeOut = 10000, OnTaskDone cb = null) { WebTask task = new WebTask(url, method, head, body, contentType, timeOut, cb); GetWorker(id).AddTask(task); }
public HttpUpLoadTask(string _url, string[] header, string _uploadFile, string fileKey, string _saveName, bool addInfo, bool _compress, string _contentType, int _timeOut, OnTaskDone _cb) : base(_cb) { url = _url; this.header = header; uploadFile = _uploadFile; this.fileKey = fileKey; if (addInfo) { string time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"); saveName = string.Format("[{0}][{1}]{2}", time, Application.platform, _saveName); } else { saveName = _saveName; } compress = _compress; if (string.IsNullOrEmpty(_contentType)) { contentType = "application/octet-stream"; } else { contentType = _contentType; } timeOut = _timeOut; }
public override void UpdateExec() { if (cb != null) { cb(isSuccess, ret); cb = null; } }
public WebTask(string _url, string _method, string _head, string _body, string _contentType, int _timeOut, OnTaskDone _cb) : base(_cb) { url = _url; method = _method; head = _head; body = _body; timeOut = _timeOut; contentType = _contentType; }
// Update is called once per frame void Update() { if (Time.frameCount % 4 == 0 && onGoingProject) { CheckBars(); if (AllBarsAreDone()) { onGoingProject = false; resourcesManager.AddGold(Mathf.RoundToInt(currentGoldReward * AbilityManager.instance.GoldMultiplier)); if (isGameJam) { resourcesManager.GameJamDone(); } OnTaskDone?.Invoke(); spawnerScript.RequestNewProject(); } } }
public void WebRequestGet(string url, OnTaskDone cb, int id = 0) { OpenRequest(id, url, "GET", null, null, null, 10000, cb); }
public void DownloadFile(int id, string url, string savePath, int timeOut, OnTaskDone cb) { HttpDownloadTask task = new HttpDownloadTask(url, savePath, timeOut, cb); GetWorker(id).AddTask(task); }
public void UploadFile(int id, string url, string uploadFile, string fileKey, string saveName, bool addPre = false, bool compress = false, string contentType = null, string[] header = null, int timeOut = 10000, OnTaskDone cb = null) { HttpUpLoadTask task = new HttpUpLoadTask(url, header, uploadFile, fileKey, saveName, addPre, compress, contentType, timeOut, cb); GetWorker(id).AddTask(task); }
public HttpDownloadTask(string _url, string _savePath, int _timeOut, OnTaskDone _cb) : base(_cb) { url = _url; savePath = _savePath; timeOut = _timeOut; }
public WebCbTask(OnTaskDone _cb) { cb = _cb; ret = null; isSuccess = false; }