private void OnComplete(WWWTask task, bool succeed) { Log("Task over-> " + task.url); taskList.Remove(task.url); taskDict.Remove(task.url); NextTask(); }
private void NextTask() { if (taskQueue.Count <= 0) { return; } WWWTask task = taskDict[taskQueue.Dequeue()]; taskList.Add(task.url); task.StartTask(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); WWWTask task = target as WWWTask; EditorGUILayout.LabelField("URL", task.url); EditorGUILayout.Slider("progress", task.www.progress, 0, 1); if (GUI.changed) { EditorUtility.SetDirty(task); } }
public WWWTask NewTask(string url, byte[] postData, Action <WWWTask, bool> callback = null) { callback += OnComplete; WWWTask task = gameObject.AddComponent <WWWTask>(); task.SetTask(url, postData, callback); if (taskList.Count >= maxTask) { taskQueue.Enqueue(url); taskDict.Add(url, task); } else { taskList.Add(url); taskDict.Add(url, task); task.StartTask(); } return(task); }