update runtime code

重构了PersistentTools类
This commit is contained in:
hevinci
2023-07-05 15:14:21 +08:00
parent c5314c72f0
commit 2643ab81ed
15 changed files with 246 additions and 216 deletions
@@ -217,13 +217,13 @@ namespace YooAsset
if (_steps == ESteps.CheckAppFootPrint)
{
var appFootPrint = new AppFootPrint();
appFootPrint.Load();
appFootPrint.Load(_packageName);
// 如果水印发生变化,则说明覆盖安装后首次打开游戏
if (appFootPrint.IsDirty())
{
PersistentTools.DeleteManifestFolder();
appFootPrint.Coverage();
PersistentTools.GetPersistent(_packageName).DeleteSandboxManifestFilesFolder();
appFootPrint.Coverage(_packageName);
YooLogger.Log("Delete manifest files when application foot print dirty !");
}
_steps = ESteps.QueryCachePackageVersion;
@@ -374,16 +374,16 @@ namespace YooAsset
/// <summary>
/// 读取应用程序水印
/// </summary>
public void Load()
public void Load(string packageName)
{
string footPrintFilePath = PersistentTools.GetAppFootPrintFilePath();
string footPrintFilePath = PersistentTools.GetPersistent(packageName).SandboxAppFootPrintFilePath;
if (File.Exists(footPrintFilePath))
{
_footPrint = FileUtility.ReadAllText(footPrintFilePath);
}
else
{
Coverage();
Coverage(packageName);
}
}
@@ -402,14 +402,14 @@ namespace YooAsset
/// <summary>
/// 覆盖掉水印
/// </summary>
public void Coverage()
public void Coverage(string packageName)
{
#if UNITY_EDITOR
_footPrint = Application.version;
#else
_footPrint = Application.buildGUID;
#endif
string footPrintFilePath = PersistentTools.GetAppFootPrintFilePath();
string footPrintFilePath = PersistentTools.GetPersistent(packageName).SandboxAppFootPrintFilePath;
FileUtility.WriteAllText(footPrintFilePath, _footPrint);
YooLogger.Log($"Save application foot print : {_footPrint}");
}