Esempio n. 1
0
    IEnumerator Load(string fileName, string depositPath)
    {
        progressImage.fillAmount = 0;

        isLoad = true;

        dl = new DownLoad(client, depositPath, fileName);

        dl.Start();

        while (!dl.GetIsDone())
        {
            float progress = (float)dl.GetCurrentSize() / (float)dl.GetFileSize();

            progressText.text = (int)(progress * 100) + "%";

            progressImage.fillAmount = progress;

            Debug.Log("下载中~~~~~~" + dl.GetCurrentSize() + "KB/" + dl.GetFileSize() + "KB" + "||fileName" + dl.GetFileName() + "||Name" + dl.GetName() + "||Path" + dl.GetPath());

            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("下载完成~~~~~~" + dl.GetCurrentSize() + "/" + dl.GetFileSize());

        isLoad = false;

        progressText.text = "100%";

        progressImage.fillAmount = 1;

        dl = null;

        //Debug.Log("内容是:" + File.ReadAllText(depositPath + "\\" + fileName, Encoding.UTF8));
    }