示例#1
0
    //下载切换
    void DownSwitch()
    {
        string tmpName = Ready_Download_list[ndr].name;
        string tmpUrl  = Ready_Download_list[ndr].url;//+ "?v=" + System.DateTime.Now;

        string filePath;

        switch (Ready_Download_list[ndr].type.ToLower())
        {
        case "anim_ab":
            filePath = PublicClass.Anim_TimelinePath + tmpName;
            PublicClass.Anim_ABPath = filePath;
            break;

        case "ab":
            filePath = PublicClass.filePath + tmpName;
            break;

        case "db":
            filePath = PublicClass.vesal_db_path + tmpName;
            break;

        case "update":
            filePath = PublicClass.filePath + tmpName;
            break;

        case "lua":
            filePath = PublicClass.filePath + tmpName;
            Vesal_DirFiles.ClearFolder(PublicClass.xluaPath);
            break;

        default:
            filePath = PublicClass.filePath + tmpName;
            break;
        }


        Debug.Log("当前下载资源:" + tmpName + " 路径:" + tmpUrl + "version " + Ready_Download_list[ndr].version);
        Vesal_DirFiles.DelFile(filePath);

        if (!http.DownLoad(tmpUrl, filePath, Download, Download_error))
        {
            Unity_Tools.ui_return_to_platform();
            Application.Quit(); //下载过程中,连接断开,重连失败
        }
    }