Update YooAsset

This commit is contained in:
hevinci
2022-03-09 23:57:04 +08:00
parent 1c7b90806c
commit a00924bb54
39 changed files with 283 additions and 369 deletions

View File

@@ -59,8 +59,8 @@ namespace YooAsset
if (_steps == ESteps.LoadAppManifest)
{
string filePath = AssetPathHelper.MakeStreamingLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
_downloadURL = AssetPathHelper.ConvertToWWWPath(filePath);
string filePath = PathHelper.MakeStreamingLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
_downloadURL = PathHelper.ConvertToWWWPath(filePath);
_downloader = new UnityWebRequester();
_downloader.SendRequest(_downloadURL);
_steps = ESteps.CheckAppManifest;
@@ -134,11 +134,11 @@ namespace YooAsset
if (_impl.ClearCacheWhenDirty)
{
YooLogger.Warning("Clear cache files.");
PatchHelper.DeleteSandboxCacheFolder();
SandboxHelper.DeleteSandboxCacheFolder();
}
// 删除清单文件
PatchHelper.DeleteSandboxPatchManifestFile();
SandboxHelper.DeleteSandboxPatchManifestFile();
// 更新缓存文件
PatchCache.UpdateCache();
}
@@ -149,8 +149,8 @@ namespace YooAsset
{
// 加载APP内的补丁清单
YooLogger.Log($"Load application patch manifest.");
string filePath = AssetPathHelper.MakeStreamingLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
_downloadURL = AssetPathHelper.ConvertToWWWPath(filePath);
string filePath = PathHelper.MakeStreamingLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
_downloadURL = PathHelper.ConvertToWWWPath(filePath);
_downloader = new UnityWebRequester();
_downloader.SendRequest(_downloadURL);
_steps = ESteps.CheckAppManifest;
@@ -181,10 +181,10 @@ namespace YooAsset
if (_steps == ESteps.LoadSandboxManifest)
{
// 加载沙盒内的补丁清单
if (PatchHelper.CheckSandboxPatchManifestFileExist())
if (SandboxHelper.CheckSandboxPatchManifestFileExist())
{
YooLogger.Log($"Load sandbox patch manifest.");
string filePath = AssetPathHelper.MakePersistentLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
string filePath = PathHelper.MakePersistentLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
string jsonData = File.ReadAllText(filePath);
_impl.LocalPatchManifest = PatchManifest.Deserialize(jsonData);
}

View File

@@ -122,7 +122,7 @@ namespace YooAsset
_downloaderHash.Dispose();
// 如果补丁清单文件的哈希值相同
string currentFileHash = PatchHelper.GetSandboxPatchManifestFileHash();
string currentFileHash = SandboxHelper.GetSandboxPatchManifestFileHash();
if (currentFileHash == webManifestHash)
{
YooLogger.Log($"Patch manifest file hash is not change : {webManifestHash}");
@@ -206,7 +206,7 @@ namespace YooAsset
// 注意:这里会覆盖掉沙盒内的补丁清单文件
YooLogger.Log("Save remote patch manifest file.");
string savePath = AssetPathHelper.MakePersistentLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
string savePath = PathHelper.MakePersistentLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
PatchManifest.Serialize(savePath, _impl.LocalPatchManifest);
}
@@ -246,7 +246,7 @@ namespace YooAsset
}
// 查看文件是否存在
string filePath = PatchHelper.MakeSandboxCacheFilePath(patchBundle.Hash);
string filePath = SandboxHelper.MakeSandboxCacheFilePath(patchBundle.Hash);
if (File.Exists(filePath) == false)
continue;
@@ -285,7 +285,7 @@ namespace YooAsset
}
private bool RunThread(PatchBundle patchBundle)
{
string filePath = PatchHelper.MakeSandboxCacheFilePath(patchBundle.Hash);
string filePath = SandboxHelper.MakeSandboxCacheFilePath(patchBundle.Hash);
ThreadInfo info = new ThreadInfo(filePath, patchBundle);
return ThreadPool.QueueUserWorkItem(new WaitCallback(VerifyFile), info);
}