Exemple #1
0
 private void OnComplete(WWWTask task, bool succeed)
 {
     Log("Task over-> " + task.url);
     taskList.Remove(task.url);
     taskDict.Remove(task.url);
     NextTask();
 }
Exemple #2
0
        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);
            }
        }
Exemple #4
0
        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);
        }