예제 #1
0
    /// <summary>
    /// 递归下载
    /// </summary>
    void RecursiveDown()
    {
        if (!(loadCount < keys.Count))
        {
            DownLoadEnd();
            return;
        }

        string key = keys[loadCount];

        Logger.Log("RecursiveDown key :" + key);

        if (string.IsNullOrEmpty(key))
        {
            loadCount++;
            RecursiveDown();
            return;
        }

        List <string> item = null;

        if (needUpDic.TryGetValue(key, out item))
        {
            string loadUrl = url + "Android/" + key;
            loadCount++;
            MyHttp.Download(loadUrl, PathUtils.ABPath, key, RecursiveDown, ProgressrateCallBack);
            DownLoadStart(key);
        }
        else
        {
            loadCount++;
            RecursiveDown();
        }
    }
예제 #2
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(0, 0, Screen.width * 0.2f, Screen.height * 0.1f), "start"))
     {
         //Important: can not contain"?"when create file, you should choose a new download url for testing(ps. or rename the download file's name)
         string url  = "http://153.37.232.46/sqdd.myapp.com/myapp/qqteam/AndroidQQ/mobileqq_android.apk?mkey=56417d90de3bd6cf&f=8f5d&p=.apk";
         string file = Application.persistentDataPath + "/download";
         http.Download(url, file);
     }
     if (GUI.Button(new Rect(0, Screen.height * 0.2f, Screen.width * 0.2f, Screen.height * 0.1f), "stop"))
     {
         http.Close();
     }
 }