From 484089cd75ea6c54b539b1986abee33627c06ea2 Mon Sep 17 00:00:00 2001 From: wangxiaolong Date: Fri, 18 Sep 2020 14:29:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=82=E6=AD=A5=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=8A=A0=E8=BD=BD=E6=97=A5=E5=BF=97=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Bridge/ResourcesManager.cs | 4 ++++ .../ResLoader/RuntimeResLoader.cs | 22 ++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Bridge/ResourcesManager.cs b/Assets/Scripts/Bridge/ResourcesManager.cs index 42023d3027..d81773cb3b 100644 --- a/Assets/Scripts/Bridge/ResourcesManager.cs +++ b/Assets/Scripts/Bridge/ResourcesManager.cs @@ -82,8 +82,12 @@ namespace GameLogic { { if (luaFunction != null) { + Debug.Log("ResourcesManager LoadAssetAsync luaFunc"); luaFunction.Call(name, obj); } + else { + Debug.Log("ResourcesManager LoadAssetAsync luaFunc ==null"); + } }); } diff --git a/Assets/Scripts/Core/ResMgr/ResourcesMgr/ResLoader/RuntimeResLoader.cs b/Assets/Scripts/Core/ResMgr/ResourcesMgr/ResLoader/RuntimeResLoader.cs index 006e8679b8..10e4d9a4ca 100644 --- a/Assets/Scripts/Core/ResMgr/ResourcesMgr/ResLoader/RuntimeResLoader.cs +++ b/Assets/Scripts/Core/ResMgr/ResourcesMgr/ResLoader/RuntimeResLoader.cs @@ -219,6 +219,7 @@ namespace ResMgr ResData resData = null; if (resFailedMap.TryGetValue(name, out resData)) { + Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " in resFailedMap!"); action(name, null); return; } @@ -227,13 +228,16 @@ namespace ResMgr if (resData.IsFinish) { resData.RefCount++; + Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData.IsFinish!"); action(name, resData.Asset as T); } else { + Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData not Finish!"); resData.RefCount++; resData.OnLoadFinish.AddListener(() => { + Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData.IsFinish 2!"); action(name, resData.Asset as T); }); } @@ -243,7 +247,7 @@ namespace ResMgr string path = ResPathConfig.GetABName(name); if (string.IsNullOrEmpty(path)) { - if (BaseLogger.isDebug) BaseLogger.LogErrorFormat("没有找到资源包{0}的AssetBundle!path:", name, path); + Debug.LogError("RunttimeResLoader LoadAssetAsync path err path: " + path); action(name, null); return; } @@ -252,25 +256,33 @@ namespace ResMgr resData.RefCount++; resData.OnLoadFinish.AddListener(() => { + Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData.IsFinish 3!"); action(name, resData.Asset as T); }); resMap.Add(name, resData); AssetBundleManager.Instance.LoadAssetBundleAsyn(path, (tmpLoader) => { + if (tmpLoader == null) + { + Debug.Log("RunttimeResLoader LoadAssetAsync tmpLoader == null abname: " + name); + } + if (tmpLoader.AbLoaderState == ABLoaderState.Failed) { - if (BaseLogger.isDebug) BaseLogger.LogErrorFormat("异步加载资源失败:{0}", name); + Debug.LogError("RunttimeResLoader LoadAssetAsync ABLoaderState.Failed ab name: " + name); OnLoadFailed(resData, tmpLoader); return; } tmpLoader.LoadAssetAsyn(name, (tmpAsset) => { if (tmpAsset != null) - resData.LoadSuccess(tmpLoader, tmpAsset); - else { + Debug.LogError("RunttimeResLoader LoadAssetAsync tmpAsset!=null ab name: " + name); + resData.LoadSuccess(tmpLoader, tmpAsset); + }else + { + Debug.LogError("RunttimeResLoader LoadAssetAsync tmpAsset==null ab name: " + name); OnLoadFailed(resData, tmpLoader); - if (BaseLogger.isDebug) BaseLogger.LogErrorFormat("异步加载资源失败:{0}", name); } }); }, ResPathConfig);