예제 #1
0
    private void OnNewResLoadComplete(object content)
    {
        WWW         www          = content as WWW;
        FileVerInfo loadedFile   = _loadFileDic[www.url];
        string      relativePath = loadedFile.relativePath;
        string      outputPath   = AssetPathUtil.PersistentDataPath + relativePath;

        using (FileStream fileStream = System.IO.File.Create(outputPath))
        {
            fileStream.Write(www.bytes, 0, www.bytes.Length);
            fileStream.Flush();
            fileStream.Close();
        }
        VersionManager.AddCacheFileInfo(loadedFile);
        _loadedCount++;
        _loadingView.SetPercent((float)_loadedCount / _totalCount - 0.01f);
        if (_loadedCount == _totalCount)
        {
            _isStartUpdate = false;
            _loadingView.SetTitle("正在解压资源,不消耗任何流量。");
            VersionManager.localVersion = VersionManager.remoteVersion;
            VersionManager.SaveCacheVersionFile(false);
            StartGame();
        }
    }