From 0fa617a09eedf6bdb25eda55fac1d3344859fd93 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 31 三月 2026 19:46:31 +0800
Subject: [PATCH] webgl
---
Main/System/AssetVersion/DownloadHotMgr.cs | 43 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/Main/System/AssetVersion/DownloadHotMgr.cs b/Main/System/AssetVersion/DownloadHotMgr.cs
index 98221dd..497331e 100644
--- a/Main/System/AssetVersion/DownloadHotMgr.cs
+++ b/Main/System/AssetVersion/DownloadHotMgr.cs
@@ -223,10 +223,26 @@
public string SpeedFormat { get { return StringUtility.FormatSpeed(downloadedSpeed); } }
//鏈湴鏂囦欢澶у皬
- public long LocalLength { get { return (File.Exists(tempFile)) ? (new FileInfo(tempFile)).Length : 0L; } }
+ public long LocalLength {
+ get {
+#if UNITY_WEBGL
+ return 0L;
+#else
+ return (File.Exists(tempFile)) ? (new FileInfo(tempFile)).Length : 0L;
+#endif
+ }
+ }
//鏈湴鏂囦欢鏈�鍚庝慨鏀规椂闂�
- private System.DateTime LocalLastModified { get { return File.Exists(tempFile) ? File.GetLastWriteTime(tempFile) : DateTime.MinValue; } }
+ private System.DateTime LocalLastModified {
+ get {
+#if UNITY_WEBGL
+ return DateTime.MinValue;
+#else
+ return File.Exists(tempFile) ? File.GetLastWriteTime(tempFile) : DateTime.MinValue;
+#endif
+ }
+ }
public bool IsWorking { get { return state == TaskState.Working; } }
public bool IsDone { get { return state == TaskState.Succeed; } }
@@ -250,9 +266,13 @@
private bool IsOutdated //鏈湴鏂囦欢鏄惁宸茶繃鏃�
{
get {
+#if UNITY_WEBGL
+ return false;
+#else
if (File.Exists(tempFile))
return remoteLastModified > LocalLastModified;
return false;
+#endif
}
}
@@ -279,15 +299,19 @@
public bool BeginDownload(Action<DownloadHotTask> onCompleted)
{
- if ((IsWorking && requestHeaderOk) || IsDone)//宸茬粡鍦ㄤ笅杞戒换鍔′腑鎴栧凡缁忎笅杞藉畬鎴愪簡
+#if UNITY_WEBGL
+ Debug.LogWarning("DownloadHotTask: 鏂囦欢涓嬭浇鍦╓ebGL涓婁笉鏀寔");
+ return false;
+#else
+ if ((IsWorking && requestHeaderOk) || IsDone)
return false;
- if (state == TaskState.Wait)//绗竴娆″皾璇�
+ if (state == TaskState.Wait)
failedTimes = 0;
this.onCompleted = onCompleted;
this.isStop = false;
Co_DownloadFile().Forget();
- // SnxxzGame.Instance.StartCoroutine(Co_DownloadFile());
return true;
+#endif
}
//鍋滄涓嬭浇
@@ -450,8 +474,12 @@
private async UniTask Move(string sourceFile, string destFile)
{
-
- var copyState = 0;//澶嶅埗鏂囦欢鐘舵�侊紝0绛夊緟锛�1鎴愬姛锛�2澶辫触
+#if UNITY_WEBGL
+ SetFailed("WebGL涓嶆敮鎸佹枃浠舵搷浣�");
+ await UniTask.CompletedTask;
+ return;
+#else
+ var copyState = 0;
try
{
if (File.Exists(destFile))
@@ -474,6 +502,7 @@
SetFailed("涓存椂鏂囦欢鏀瑰悕鍑洪敊");
await UniTask.CompletedTask;
+#endif
}
}
--
Gitblit v1.8.0