添加异步资源加载日志说明
parent
600044eab5
commit
484089cd75
|
|
@ -82,8 +82,12 @@ namespace GameLogic {
|
||||||
{
|
{
|
||||||
if (luaFunction != null)
|
if (luaFunction != null)
|
||||||
{
|
{
|
||||||
|
Debug.Log("ResourcesManager LoadAssetAsync luaFunc");
|
||||||
luaFunction.Call(name, obj);
|
luaFunction.Call(name, obj);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Debug.Log("ResourcesManager LoadAssetAsync luaFunc ==null");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,7 @@ namespace ResMgr
|
||||||
ResData resData = null;
|
ResData resData = null;
|
||||||
if (resFailedMap.TryGetValue(name, out resData))
|
if (resFailedMap.TryGetValue(name, out resData))
|
||||||
{
|
{
|
||||||
|
Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " in resFailedMap!");
|
||||||
action(name, null);
|
action(name, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -227,13 +228,16 @@ namespace ResMgr
|
||||||
if (resData.IsFinish)
|
if (resData.IsFinish)
|
||||||
{
|
{
|
||||||
resData.RefCount++;
|
resData.RefCount++;
|
||||||
|
Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData.IsFinish!");
|
||||||
action(name, resData.Asset as T);
|
action(name, resData.Asset as T);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData not Finish!");
|
||||||
resData.RefCount++;
|
resData.RefCount++;
|
||||||
resData.OnLoadFinish.AddListener(() =>
|
resData.OnLoadFinish.AddListener(() =>
|
||||||
{
|
{
|
||||||
|
Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData.IsFinish 2!");
|
||||||
action(name, resData.Asset as T);
|
action(name, resData.Asset as T);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -243,7 +247,7 @@ namespace ResMgr
|
||||||
string path = ResPathConfig.GetABName(name);
|
string path = ResPathConfig.GetABName(name);
|
||||||
if (string.IsNullOrEmpty(path))
|
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);
|
action(name, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -252,25 +256,33 @@ namespace ResMgr
|
||||||
resData.RefCount++;
|
resData.RefCount++;
|
||||||
resData.OnLoadFinish.AddListener(() =>
|
resData.OnLoadFinish.AddListener(() =>
|
||||||
{
|
{
|
||||||
|
Debug.LogError("RunttimeResLoader LoadAssetAsync ab name: " + name + " resData.IsFinish 3!");
|
||||||
action(name, resData.Asset as T);
|
action(name, resData.Asset as T);
|
||||||
});
|
});
|
||||||
resMap.Add(name, resData);
|
resMap.Add(name, resData);
|
||||||
AssetBundleManager.Instance.LoadAssetBundleAsyn(path, (tmpLoader) =>
|
AssetBundleManager.Instance.LoadAssetBundleAsyn(path, (tmpLoader) =>
|
||||||
{
|
{
|
||||||
|
if (tmpLoader == null)
|
||||||
|
{
|
||||||
|
Debug.Log("RunttimeResLoader LoadAssetAsync tmpLoader == null abname: " + name);
|
||||||
|
}
|
||||||
|
|
||||||
if (tmpLoader.AbLoaderState == ABLoaderState.Failed)
|
if (tmpLoader.AbLoaderState == ABLoaderState.Failed)
|
||||||
{
|
{
|
||||||
if (BaseLogger.isDebug) BaseLogger.LogErrorFormat("异步加载资源失败:{0}", name);
|
Debug.LogError("RunttimeResLoader LoadAssetAsync ABLoaderState.Failed ab name: " + name);
|
||||||
OnLoadFailed(resData, tmpLoader);
|
OnLoadFailed(resData, tmpLoader);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpLoader.LoadAssetAsyn<T>(name, (tmpAsset) =>
|
tmpLoader.LoadAssetAsyn<T>(name, (tmpAsset) =>
|
||||||
{
|
{
|
||||||
if (tmpAsset != null)
|
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);
|
OnLoadFailed(resData, tmpLoader);
|
||||||
if (BaseLogger.isDebug) BaseLogger.LogErrorFormat("异步加载资源失败:{0}", name);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, ResPathConfig);
|
}, ResPathConfig);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue