From ca8f2321597c689b8ff8b61b8a3e47d604d29277 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期三, 26 九月 2018 11:53:45 +0800
Subject: [PATCH] 3627 客户端添加是否开启资源下载功能,由后台控制
---
Core/GameEngine/Login/Launch.cs | 147 ++++++++++++++++++++++++++++---------------------
1 files changed, 84 insertions(+), 63 deletions(-)
diff --git a/Core/GameEngine/Login/Launch.cs b/Core/GameEngine/Login/Launch.cs
index a3bd2eb..08a4a36 100644
--- a/Core/GameEngine/Login/Launch.cs
+++ b/Core/GameEngine/Login/Launch.cs
@@ -118,69 +118,6 @@
progress = 0.1f;
break;
}
-#endif
-
-#if UNITY_IOS && !UNITY_EDITOR
- switch (VersionConfig.Get().assetAccess)
- {
- case InstalledAsset.FullAsset:
- case InstalledAsset.HalfAsset:
- case InstalledAsset.IngoreDownLoad:
- if (!SDKUtility.Instance.AssetCopyFinished)
- {
- m_CurrentStage = LaunchStage.AssetCopy;
- progressBuf = progress;
-
- var allFiles = new List<FileInfo>();
- FileExtersion.GetAllDirectoryFileInfos(ResourcesPath.Instance.StreamingAssetPath, allFiles);
-
- var count = allFiles.Count;
- var index = 0;
- while (index < count)
- {
- try
- {
- var fileInfo = allFiles[index];
- var destPath = fileInfo.FullName.Replace(ResourcesPath.Instance.StreamingAssetPath, ResourcesPath.Instance.ExternalStorePath);
- if (File.Exists(destPath))
- {
- index++;
- continue;
- }
-
- var destDirectoryName = Path.GetDirectoryName(destPath);
- if (!Directory.Exists(destDirectoryName))
- {
- Directory.CreateDirectory(destDirectoryName);
- }
-
- DebugEx.LogFormat("鎷疯礉鏂囦欢锛歿0}", fileInfo.Name);
- File.Copy(fileInfo.FullName, destPath, true);
- index++;
- }
- catch (Exception ex)
- {
- DebugEx.Log(ex);
- }
- finally
- {
- progress = Mathf.Clamp(progressBuf + ((float)index / count) * 0.3f, progressBuf, progressBuf + 0.3f);
- }
-
- yield return null;
- }
-
- LocalSave.SetString("AssetCopyCompleted_IOS", VersionConfig.Get().version);
- }
- break;
- case InstalledAsset.NullAsset:
- progress = 0.1f;
- break;
- }
-#endif
-
- OperationLogCollect.Instance.RecordLauchEvent(2);
- OperationLogCollect.Instance.RecordEvent(2);
m_CurrentStage = LaunchStage.ClientVersion;
if (!Application.isEditor || InGameDownTestUtility.enable)
@@ -197,6 +134,90 @@
yield return null;
}
}
+#endif
+
+#if UNITY_IOS && !UNITY_EDITOR
+
+ m_CurrentStage = LaunchStage.ClientVersion;
+ if (!Application.isEditor || InGameDownTestUtility.enable)
+ {
+ VersionUtility.Instance.RequestVersionCheck();
+ progressBuf = progress;
+ timer = 0f;
+ duration = 1f;
+
+ while (!VersionUtility.Instance.completed)
+ {
+ timer += Time.deltaTime;
+ progress = Mathf.Clamp(progressBuf + timer / duration * 0.1f, progressBuf, progressBuf + 0.1f);
+ yield return null;
+ }
+ }
+
+ if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
+ {
+ switch (VersionConfig.Get().assetAccess)
+ {
+ case InstalledAsset.FullAsset:
+ case InstalledAsset.HalfAsset:
+ case InstalledAsset.IngoreDownLoad:
+ if (!SDKUtility.Instance.AssetCopyFinished)
+ {
+ m_CurrentStage = LaunchStage.AssetCopy;
+ progressBuf = progress;
+
+ var allFiles = new List<FileInfo>();
+ FileExtersion.GetAllDirectoryFileInfos(ResourcesPath.Instance.StreamingAssetPath, allFiles);
+
+ var count = allFiles.Count;
+ var index = 0;
+ while (index < count)
+ {
+ try
+ {
+ var fileInfo = allFiles[index];
+ var destPath = fileInfo.FullName.Replace(ResourcesPath.Instance.StreamingAssetPath, ResourcesPath.Instance.ExternalStorePath);
+ if (File.Exists(destPath))
+ {
+ index++;
+ continue;
+ }
+
+ var destDirectoryName = Path.GetDirectoryName(destPath);
+ if (!Directory.Exists(destDirectoryName))
+ {
+ Directory.CreateDirectory(destDirectoryName);
+ }
+
+ DebugEx.LogFormat("鎷疯礉鏂囦欢锛歿0}", fileInfo.Name);
+ File.Copy(fileInfo.FullName, destPath, true);
+ index++;
+ }
+ catch (Exception ex)
+ {
+ DebugEx.Log(ex);
+ }
+ finally
+ {
+ progress = Mathf.Clamp(progressBuf + ((float)index / count) * 0.3f, progressBuf, progressBuf + 0.3f);
+ }
+
+ yield return null;
+ }
+
+ LocalSave.SetString("AssetCopyCompleted_IOS", VersionConfig.Get().version);
+ }
+ break;
+ case InstalledAsset.NullAsset:
+ progress = 0.1f;
+ break;
+ }
+ }
+
+#endif
+
+ OperationLogCollect.Instance.RecordLauchEvent(2);
+ OperationLogCollect.Instance.RecordEvent(2);
if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
{
--
Gitblit v1.8.0