From d2dd33cc0ca421e276d50abc46688f5db83aa42b Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期二, 13 十一月 2018 19:45:39 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
Core/ResModule/AssetBundle/AssetBundleUtility.cs | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/Core/ResModule/AssetBundle/AssetBundleUtility.cs b/Core/ResModule/AssetBundle/AssetBundleUtility.cs
index e2b4702..9919ef1 100644
--- a/Core/ResModule/AssetBundle/AssetBundleUtility.cs
+++ b/Core/ResModule/AssetBundle/AssetBundleUtility.cs
@@ -8,6 +8,8 @@
public class AssetBundleUtility : SingletonMonobehaviour<AssetBundleUtility>
{
private List<AssetBundleInfo> m_AssetBundleInfoList = new List<AssetBundleInfo>();
+ private List<string> m_LoadingAssetBundleList = new List<string>();
+ private List<string> m_LoadingAssetList = new List<string>();
private Dictionary<string, AssetInfo> m_AssetInfoDict = new Dictionary<string, AssetInfo>();
private Dictionary<string, AssetBundle> m_AssetBundleDict = new Dictionary<string, AssetBundle>();
private Dictionary<string, Dictionary<string, UnityEngine.Object>> m_AssetDict = new Dictionary<string, Dictionary<string, UnityEngine.Object>>();
@@ -187,6 +189,18 @@
yield break;
}
+ if (m_LoadingAssetBundleList.Contains(assetBundleName))
+ {
+ while (!m_AssetBundleDict.ContainsKey(assetBundleName))
+ {
+ // Debug.Log(Time.frameCount + " ] 姝e湪鍔犺浇AssetBundle: " + assetBundleName + ", 璇风瓑寰�...");
+ yield return null;
+ }
+ yield break;
+ }
+
+ m_LoadingAssetBundleList.Add(assetBundleName);
+
var _assetBundleInfo = GetAssetBundleInfo(assetBundleName);
if (_assetBundleInfo == null)
{
@@ -211,6 +225,8 @@
}
CacheAssetBundle(assetBundleName, _request.assetBundle);
+
+ m_LoadingAssetBundleList.Remove(assetBundleName);
}
private IEnumerator Co_LoadAssetBundleDependenice(AssetBundleInfo assetBundleInfo)
@@ -242,11 +258,35 @@
private IEnumerator Co_DoLoadAsset(string assetBundleName, string assetName, Action<bool, UnityEngine.Object> callBack = null)
{
+#if UNITY_5
+ assetBundleName = assetBundleName.ToLower();
+#endif
+
#if UNITY_EDITOR
RunTimeABLoadLog.AddLog(assetBundleName, assetName, UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
#endif
yield return Co_LoadAssetBundle(assetBundleName);
+
+ string _checkTag = assetBundleName + "@" + assetName;
+ if (m_LoadingAssetList.Contains(_checkTag))
+ {
+ while (!m_AssetDict.ContainsKey(assetBundleName)
+ || !m_AssetDict[assetBundleName].ContainsKey(assetName))
+ {
+ // Debug.Log(Time.frameCount + " ] 姝e湪鍔犺浇Asset: " + _checkTag + ", 璇风瓑寰�...");
+ yield return null;
+ }
+
+ if (callBack != null)
+ {
+ callBack(true, m_AssetDict[assetBundleName][assetName]);
+ }
+
+ yield break;
+ }
+
+ m_LoadingAssetList.Add(_checkTag);
var request = m_AssetBundleDict[assetBundleName].LoadAssetAsync(assetName);
while (!request.isDone)
@@ -270,6 +310,7 @@
}
}
+ m_LoadingAssetList.Remove(_checkTag);
}
private IEnumerator Co_DoLoadAsset(AssetInfo assetInfo, Action<bool, UnityEngine.Object> callBack = null)
--
Gitblit v1.8.0