Skip to content

Commit 1890be3

Browse files
author
wanderer
committed
资源下载完了,更新本地版本信息
1 parent 2d3a1ff commit 1890be3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

GameFramework/Runtime/Resource/ResourceVersion.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ private async void OnDownloadCallback(string remoteUrl, string localPath, bool r
256256
//所有的文件下载完成
257257
if (flags&& _needDownloadFiles.Count==_downloadingFiles.Count)
258258
{
259+
UpdateLocalVersion();
259260
_downloadCallback?.Invoke(true, 1.0f,0.0f, _totleFileSize);
260261
_downloadCallback = null;
261262
_downloading = false;
@@ -296,6 +297,25 @@ private void OnDownloadProccess(string remoteUrl, string localPath, ulong fileSi
296297
#endregion
297298

298299
#region 内部函数
300+
/// <summary>
301+
/// 更新本地版本信息
302+
/// </summary>
303+
private void UpdateLocalVersion()
304+
{
305+
if (CheckResource())
306+
{
307+
LocalVersion = RemoteVersion;
308+
309+
string versionAssetPath = Path.Combine(_localResourcePath, _assetVersionTxt);
310+
string content = JsonUtility.ToJson(LocalVersion).ToEncrypt();
311+
if (File.Exists(versionAssetPath))
312+
{
313+
File.Delete(versionAssetPath);
314+
}
315+
File.WriteAllText(versionAssetPath, content);
316+
}
317+
}
318+
299319
//整理下载资源
300320
private async void CollateDownloadResources()
301321
{

0 commit comments

Comments
 (0)