Update YooAsset
This commit is contained in:
@@ -81,7 +81,7 @@ namespace YooAsset
|
||||
}
|
||||
internal override void Start()
|
||||
{
|
||||
Logger.Log($"Begine to download : {TotalDownloadCount} files and {TotalDownloadBytes} bytes");
|
||||
YooLogger.Log($"Begine to download : {TotalDownloadCount} files and {TotalDownloadBytes} bytes");
|
||||
_steps = ESteps.Loading;
|
||||
}
|
||||
internal override void Update()
|
||||
@@ -174,7 +174,7 @@ namespace YooAsset
|
||||
{
|
||||
if (_steps == ESteps.None)
|
||||
{
|
||||
OperationUpdater.ProcessOperaiton(this);
|
||||
OperationSystem.ProcessOperaiton(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,12 +128,12 @@ namespace YooAsset
|
||||
PatchCache cache = PatchCache.LoadCache();
|
||||
if (cache.CacheAppVersion != Application.version)
|
||||
{
|
||||
Logger.Warning($"Cache is dirty ! Cache app version is {cache.CacheAppVersion}, Current app version is {Application.version}");
|
||||
YooLogger.Warning($"Cache is dirty ! Cache app version is {cache.CacheAppVersion}, Current app version is {Application.version}");
|
||||
|
||||
// 注意:在覆盖安装的时候,会保留APP沙盒目录,可以选择清空缓存目录
|
||||
if (_impl.ClearCacheWhenDirty)
|
||||
{
|
||||
Logger.Warning("Clear cache files.");
|
||||
YooLogger.Warning("Clear cache files.");
|
||||
PatchHelper.DeleteSandboxCacheFolder();
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace YooAsset
|
||||
if (_steps == ESteps.LoadAppManifest)
|
||||
{
|
||||
// 加载APP内的补丁清单
|
||||
Logger.Log($"Load application patch manifest.");
|
||||
YooLogger.Log($"Load application patch manifest.");
|
||||
string filePath = AssetPathHelper.MakeStreamingLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
|
||||
_downloadURL = AssetPathHelper.ConvertToWWWPath(filePath);
|
||||
_downloader = new UnityWebRequester();
|
||||
@@ -183,7 +183,7 @@ namespace YooAsset
|
||||
// 加载沙盒内的补丁清单
|
||||
if (PatchHelper.CheckSandboxPatchManifestFileExist())
|
||||
{
|
||||
Logger.Log($"Load sandbox patch manifest.");
|
||||
YooLogger.Log($"Load sandbox patch manifest.");
|
||||
string filePath = AssetPathHelper.MakePersistentLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
|
||||
string jsonData = File.ReadAllText(filePath);
|
||||
_impl.LocalPatchManifest = PatchManifest.Deserialize(jsonData);
|
||||
|
||||
@@ -81,11 +81,11 @@ namespace YooAsset
|
||||
|
||||
if (_impl.IgnoreResourceVersion && _updateResourceVersion > 0)
|
||||
{
|
||||
Logger.Warning($"Update resource version {_updateResourceVersion} is invalid when ignore resource version.");
|
||||
YooLogger.Warning($"Update resource version {_updateResourceVersion} is invalid when ignore resource version.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Log($"Update patch manifest : update resource version is {_updateResourceVersion}");
|
||||
YooLogger.Log($"Update patch manifest : update resource version is {_updateResourceVersion}");
|
||||
}
|
||||
}
|
||||
internal override void Update()
|
||||
@@ -96,7 +96,7 @@ namespace YooAsset
|
||||
if (_steps == ESteps.LoadWebManifestHash)
|
||||
{
|
||||
string webURL = GetPatchManifestRequestURL(_updateResourceVersion, ResourceSettingData.Setting.PatchManifestHashFileName);
|
||||
Logger.Log($"Beginning to request patch manifest hash : {webURL}");
|
||||
YooLogger.Log($"Beginning to request patch manifest hash : {webURL}");
|
||||
_downloaderHash = new UnityWebRequester();
|
||||
_downloaderHash.SendRequest(webURL, _timeout);
|
||||
_steps = ESteps.CheckWebManifestHash;
|
||||
@@ -125,12 +125,12 @@ namespace YooAsset
|
||||
string currentFileHash = PatchHelper.GetSandboxPatchManifestFileHash();
|
||||
if (currentFileHash == webManifestHash)
|
||||
{
|
||||
Logger.Log($"Patch manifest file hash is not change : {webManifestHash}");
|
||||
YooLogger.Log($"Patch manifest file hash is not change : {webManifestHash}");
|
||||
_steps = ESteps.InitPrepareCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Log($"Patch manifest hash is change : {webManifestHash} -> {currentFileHash}");
|
||||
YooLogger.Log($"Patch manifest hash is change : {webManifestHash} -> {currentFileHash}");
|
||||
_steps = ESteps.LoadWebManifest;
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace YooAsset
|
||||
if (_steps == ESteps.LoadWebManifest)
|
||||
{
|
||||
string webURL = GetPatchManifestRequestURL(_updateResourceVersion, ResourceSettingData.Setting.PatchManifestFileName);
|
||||
Logger.Log($"Beginning to request patch manifest : {webURL}");
|
||||
YooLogger.Log($"Beginning to request patch manifest : {webURL}");
|
||||
_downloaderManifest = new UnityWebRequester();
|
||||
_downloaderManifest.SendRequest(webURL, _timeout);
|
||||
_steps = ESteps.CheckWebManifest;
|
||||
@@ -179,7 +179,7 @@ namespace YooAsset
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
float costTime = UnityEngine.Time.realtimeSinceStartup - _verifyTime;
|
||||
Logger.Log($"Verify files total time : {costTime}");
|
||||
YooLogger.Log($"Verify files total time : {costTime}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace YooAsset
|
||||
_impl.LocalPatchManifest = PatchManifest.Deserialize(content);
|
||||
|
||||
// 注意:这里会覆盖掉沙盒内的补丁清单文件
|
||||
Logger.Log("Save remote patch manifest file.");
|
||||
YooLogger.Log("Save remote patch manifest file.");
|
||||
string savePath = AssetPathHelper.MakePersistentLoadPath(ResourceSettingData.Setting.PatchManifestFileName);
|
||||
PatchManifest.Serialize(savePath, _impl.LocalPatchManifest);
|
||||
}
|
||||
@@ -276,7 +276,7 @@ namespace YooAsset
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Warning("Failed to run verify thread.");
|
||||
YooLogger.Warning("Failed to run verify thread.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user