Пример #1
0
    void StartDownloadFile()
    {
        if (State != UpdateFileStateType.Finished)
        {
            return;
        }

        if (_downloadFileList.Count <= 0)
        {
            return;
        }

        var req = _downloadFileList[0];

        _currentUpdateFilePath = req.filePath;
        State = UpdateFileStateType.BeginDownLoad;
        StartCoroutine(DownloadFile(req));
    }
Пример #2
0
    IEnumerator DownloadFile(DownloadFileRequest req)
    {
        WWW www = new WWW(req.fileUrl);

        yield return(www);

        State = UpdateFileStateType.FinishDownload;

        if (req.isSaved)
        {
            State = UpdateFileStateType.MoveFile;
            MoveFile(req, www.text, www.bytes, www.bytes.Length);
        }

        _downloadFileList.Remove(req);
        State = UpdateFileStateType.Finished;

        if (req.onScriptDownloaded != null)
        {
            req.onScriptDownloaded(www.text);
        }
    }