コード例 #1
0
 public void Init()
 {
     if (true)
     {
         DownloadLimit = 1; RenewableResourceUpdate.Instance.Load();
     }
     RenewableFile.FolderCheck(System.IO.Path.Combine(Application.persistentDataPath, "assets/"));
 }
コード例 #2
0
        private IEnumerator Dowmload(string key, string url)
        {
            if (m_task.ContainsKey(key))
            {
                UnityWebRequest request = Request(m_task[key].Type, url);

                yield return(request.SendWebRequest());

                if (request.isDone)
                {
                    if (request.result != UnityWebRequest.Result.Success)
                    {
                        if (m_task.ContainsKey(key))
                        {
                            if (NetworkConnection)
                            {
                                m_task[key].fail?.Invoke(); m_task.Remove(key);
                            }
                            else
                            {
                                m_task[key].fail?.Invoke();
                                m_task[key].status = TaskStatus.Fail;
                            }
                        }
                        Debug.LogWarningFormat("<color=red>{0}</color>, Url:<color=blue>{1}</color>", request.error, url);
                    }
                    else
                    {
                        if (m_task.ContainsKey(key))
                        {
                            RenewableResourceUpdate.Instance.Remove(m_task[key].Key);
                            m_task[key].content = DownloadHandler(m_task[key].Type, request);
                            m_task[key].success?.Invoke(Handler(m_task[key], request, true));
                            m_task[key].status = TaskStatus.Complete;
                            switch (m_task[key].Store)
                            {
                            case StorageClass.Write:
                                if (m_task[key].Type != DownloadFileType.Bundle)
                                {
                                    RenewableFile.Write(m_task[key].Path, request.downloadHandler.data);
                                }
                                break;
                            }
                            m_task.Remove(key);
                        }
                    }
                    request.Dispose(); Next();
                }
            }
        }