111
This commit is contained in:
@@ -655,7 +655,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MainCamera: {fileID: 330585545}
|
||||
PlayMode: 0
|
||||
PlayMode: 2
|
||||
--- !u!4 &1019312449
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -59,13 +59,20 @@ namespace Tuan.GameFramework
|
||||
default:
|
||||
break;
|
||||
}
|
||||
await initializationOperation.ToUniTask();
|
||||
await initializationOperation;
|
||||
if (initializationOperation.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
MessageBox.Show()
|
||||
.SetTitle($"{data.packageName}初始化")
|
||||
.SetContent($"{initializationOperation.Error}")
|
||||
.AddButton("退出", (box) => { Application.Quit(); });
|
||||
.AddButton("退出", (box) =>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,7 +185,7 @@ namespace Tuan.GameFramework
|
||||
public async UniTask<bool> RequestPackageVersion(bool showBox = true)
|
||||
{
|
||||
var operation = package.RequestPackageVersionAsync(true, 5);
|
||||
await operation.ToUniTask();
|
||||
await operation;
|
||||
if (operation.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
if (showBox)
|
||||
@@ -189,6 +196,8 @@ namespace Tuan.GameFramework
|
||||
if (!string.IsNullOrEmpty(cachedVersion))
|
||||
{
|
||||
packageVersion = cachedVersion;
|
||||
PatchEvent.UpdateStatus($"获取缓存版本成功{data.packageName}");
|
||||
Debug.Log($"获取缓存版本成功{data.packageName}:{packageVersion}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -197,8 +206,8 @@ namespace Tuan.GameFramework
|
||||
else
|
||||
{
|
||||
packageVersion = operation.PackageVersion;
|
||||
PatchEvent.UpdateStatus($"获取版本成功{data.packageName}");
|
||||
Debug.Log($"获取版本成功{data.packageName}:{packageVersion}");
|
||||
PatchEvent.UpdateStatus($"获取远端版本成功{data.packageName}");
|
||||
Debug.Log($"获取远端版本成功{data.packageName}:{packageVersion}");
|
||||
}
|
||||
return operation.Status == EOperationStatus.Succeed;
|
||||
}
|
||||
@@ -215,7 +224,11 @@ namespace Tuan.GameFramework
|
||||
.AddButton("退出", (box) =>
|
||||
{
|
||||
completionSource.TrySetResult(false);
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
});
|
||||
bool shouldContinue = await completionSource.Task;
|
||||
return shouldContinue;
|
||||
@@ -254,7 +267,7 @@ namespace Tuan.GameFramework
|
||||
public async UniTask<bool> UpdatePackageManifest(bool showBox = true)
|
||||
{
|
||||
var operation = package.UpdatePackageManifestAsync(packageVersion, 10);
|
||||
await operation.ToUniTask();
|
||||
await operation;
|
||||
if (operation.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
if (showBox)
|
||||
@@ -262,7 +275,14 @@ namespace Tuan.GameFramework
|
||||
MessageBox.Show()
|
||||
.SetTitle($"{data.packageName}更新清单")
|
||||
.SetContent($"{operation.Error}")
|
||||
.AddButton("退出", (box) => { Application.Quit(); });
|
||||
.AddButton("退出", (box) =>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -308,7 +328,7 @@ namespace Tuan.GameFramework
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
Application.Quit();
|
||||
#endif
|
||||
});
|
||||
bool shouldContinue = await completionSource.Task;
|
||||
@@ -320,7 +340,7 @@ namespace Tuan.GameFramework
|
||||
return true;
|
||||
Debug.Log($"{data.packageName} DownloadPackageFiles {downloader.TotalDownloadCount}");
|
||||
downloader.BeginDownload();
|
||||
await downloader.ToUniTask();
|
||||
await downloader;
|
||||
if (downloader.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
if (showBox)
|
||||
@@ -328,7 +348,14 @@ namespace Tuan.GameFramework
|
||||
MessageBox.Show()
|
||||
.SetTitle($"{data.packageName}下载文件")
|
||||
.SetContent($"{downloader.Error}")
|
||||
.AddButton("退出", (box) => { Application.Quit(); });
|
||||
.AddButton("退出", (box) =>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -337,7 +364,7 @@ namespace Tuan.GameFramework
|
||||
public async UniTask<bool> ClearCacheBundle(bool showBox = true)
|
||||
{
|
||||
var operation = package.ClearCacheFilesAsync(EFileClearMode.ClearUnusedBundleFiles);
|
||||
await operation.ToUniTask();
|
||||
await operation;
|
||||
if (operation.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
if (showBox)
|
||||
@@ -345,7 +372,14 @@ namespace Tuan.GameFramework
|
||||
MessageBox.Show()
|
||||
.SetTitle($"{data.packageName}清除缓存")
|
||||
.SetContent($"{operation.Error}")
|
||||
.AddButton("退出", (box) => { Application.Quit(); });
|
||||
.AddButton("退出", (box) =>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
});
|
||||
}
|
||||
}
|
||||
return operation.Status == EOperationStatus.Succeed;
|
||||
|
||||
@@ -22,52 +22,33 @@ namespace Tuan.GameFramework
|
||||
}
|
||||
public async UniTask Execute()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
CheckIsOffline();
|
||||
#endif
|
||||
if (!await operation.InitializePackage()) return;
|
||||
var version = await GetBestPackageVersion();
|
||||
#if UNITY_EDITOR
|
||||
if (!await operation.RequestPackageVersion()) return;
|
||||
version = operation.packageVersion;
|
||||
#endif
|
||||
if (!await operation.RequestPackageVersion())
|
||||
{
|
||||
operation.packageVersion = await operation.GetBuildinPackageVersion();
|
||||
}
|
||||
//获取版本失败
|
||||
if (version == null)
|
||||
if (operation.packageVersion == null)
|
||||
{
|
||||
MessageBox.Show()
|
||||
.SetTitle($"{operation.data.packageName}获取版本")
|
||||
.SetContent("获取版本失败")
|
||||
.AddButton("退出", (box) => { Application.Quit(); });
|
||||
.AddButton("退出", (box) =>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
});
|
||||
return;
|
||||
}
|
||||
operation.packageVersion = version;
|
||||
if (!await operation.UpdatePackageManifest()) return;
|
||||
await HotDllLoader.Inst.LoadDll(YooAssets.GetPackage("Preload"), "GameScripts.Preload");
|
||||
await LoadAndShowPatchWindow();
|
||||
MainUICanvas.Inst.InitBg.SetActive(false);
|
||||
_ = UpdatePreloadPackage();
|
||||
}
|
||||
void CheckIsOffline()
|
||||
{
|
||||
if (string.IsNullOrEmpty(operation.GetCachedPackageVersion()))
|
||||
{
|
||||
operation.data.playMode = EPlayMode.OfflinePlayMode;
|
||||
}
|
||||
}
|
||||
async Task<string> GetBestPackageVersion()
|
||||
{
|
||||
string cachedVersion = operation.GetCachedPackageVersion();
|
||||
if (!string.IsNullOrEmpty(cachedVersion))
|
||||
{
|
||||
return cachedVersion;
|
||||
}
|
||||
string buildinVersion = await operation.GetBuildinPackageVersion();
|
||||
if (!string.IsNullOrEmpty(buildinVersion))
|
||||
{
|
||||
return buildinVersion;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private async UniTask LoadAndShowPatchWindow()
|
||||
{
|
||||
var assetHandle = operation.package.LoadAssetAsync<GameObject>("PatchWindow");
|
||||
@@ -82,9 +63,9 @@ namespace Tuan.GameFramework
|
||||
if (!await operation.UpdatePackageManifest(false)) return;
|
||||
if (operation.CreateDownloader())
|
||||
{
|
||||
if (!await operation.DownloadPackageFiles()) return;
|
||||
if (!await operation.DownloadPackageFiles(false)) return;
|
||||
}
|
||||
if (!await operation.ClearCacheBundle()) return;
|
||||
if (!await operation.ClearCacheBundle(false)) return;
|
||||
operation.SaveVersionToCache();
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"FileVersion": "1.0.0",
|
||||
"PackageName": "Preload",
|
||||
"PackageVersion": "2025-11-12-1073",
|
||||
"PackageVersion": "2025-11-17-627",
|
||||
"Wrappers": [
|
||||
{
|
||||
"BundleGUID": "b3d4761368f31213b75688ef3b1d4b9e",
|
||||
"BundleGUID": "982976656ae12abc351fdc9e9a2fdb42",
|
||||
"FileName": "preload_assets_gameres_preload_hotupdatedll.bundle"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1 +1 @@
|
||||
2025-11-12-1073
|
||||
2025-11-17-627
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
d55c8b5b
|
||||
BIN
Assets/StreamingAssets/yoo/Preload/Preload_2025-11-17-627.bytes
Normal file
BIN
Assets/StreamingAssets/yoo/Preload/Preload_2025-11-17-627.bytes
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bb98d3e5ae4c2a4c9d08a710d6aa4c6
|
||||
guid: 840f398ea6784d94a8a61fef019fcb63
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -0,0 +1 @@
|
||||
461ea148
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0389d7879276f2a4b88693887ea07df8
|
||||
guid: 694d1443dd56f864bb1f9dae8a87d4cd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user