添加异步资源加载日志说明
parent
600044eab5
commit
484089cd75
|
|
@ -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");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<T>(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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue