【白片】添加一些debug日志

dev_chengFeng
gaoxin 2021-04-23 11:42:27 +08:00
parent 05fbc4ba64
commit 3e3f5888d0
8 changed files with 45 additions and 28 deletions

View File

@ -73,6 +73,7 @@ function this.Close(sub)
sub.lspLoader = nil sub.lspLoader = nil
end end
resMgr:UnLoadAsset(sub.assetName) resMgr:UnLoadAsset(sub.assetName)
LogError("sub UI close: "..sub.assetName)
end end

View File

@ -679,15 +679,6 @@ function UIManager.DoLanguageCheck(spLoader, gameObject)
end end
end end
end end
else
local imageArr=gameObject:GetComponentsInChildren(typeof(UnityEngine.UI.Image),true);
for i = 0, imageArr.Length-1 do
if imageArr[i].sprite then
local imgStr=imageArr[i].sprite.name
Log("资源名称:"..imgStr)
imageArr[i].sprite = spLoader:LoadSprite(imgStr)
end
end
end end
end end
@ -749,6 +740,7 @@ function UIManager.DelayDestroyPanel(panel)
end end
function UIManager.DestroyPanel(panel) function UIManager.DestroyPanel(panel)
LogError("Panel Destroy: "..panel.uiConfig.assetName)
panel:DestroyUI() panel:DestroyUI()
GameObject.Destroy(panel.gameObject) GameObject.Destroy(panel.gameObject)
resMgr:UnLoadAsset(panel.uiConfig.assetName) resMgr:UnLoadAsset(panel.uiConfig.assetName)

View File

@ -224,8 +224,8 @@ function CarbonTypePanelV2:OnShow(...)
CheckRedPointStatus(data.redPointType) CheckRedPointStatus(data.redPointType)
end end
Util.GetGameObject(v, "bg/Mask"):SetActive(false) -- Util.GetGameObject(v, "bg/Mask"):SetActive(false)
Util.GetGameObject(v, "bg/Mask (1)"):SetActive(false) -- Util.GetGameObject(v, "bg/Mask (1)"):SetActive(false)
end end
carbonType = PlayerManager.carbonType carbonType = PlayerManager.carbonType

View File

@ -42,6 +42,9 @@ function SpriteLoader:UnLoadSprite()
LogError("SpriteLoader Repeat UnLoad : ".. self.id..", count : "..SpriteLoaderPool[self.id]) LogError("SpriteLoader Repeat UnLoad : ".. self.id..", count : "..SpriteLoaderPool[self.id])
end end
for name, count in pairs(self.SpriteList) do for name, count in pairs(self.SpriteList) do
if name == "shadow_4" then
LogWarn("lua 回收资源name:"..name..", count:"..count)
end
resMgr:UnLoadAsset(name, count) resMgr:UnLoadAsset(name, count)
end end
self.SpriteList = {} self.SpriteList = {}

View File

@ -280,6 +280,7 @@ namespace ResMgr
#endif #endif
return t; return t;
} }
Debug.LogWarning("LoadAB:" + assetName + ", Failed");
return null; return null;
} }

View File

@ -124,7 +124,11 @@ namespace ResMgr
loader.LifeTime--; loader.LifeTime--;
if (loader.LifeTime <= 0) if (loader.LifeTime <= 0)
{ {
if (!unLoadList.Contains(loader)) unLoadList.Add(loader); if (!unLoadList.Contains(loader))
{
Log(loader.Path, "AB loader UnLoad, lifeTime over: " + loader.Path);
unLoadList.Add(loader);
}
} }
} }
} }
@ -155,7 +159,13 @@ namespace ResMgr
UnLoadAssetBundle(); UnLoadAssetBundle();
} }
} }
private void Log(string path, string con)
{
if (path.Contains("shadow_4"))
{
Debug.LogWarning(con);
}
}
/// <summary> /// <summary>
/// 同步加载AB文件 /// 同步加载AB文件
/// </summary> /// </summary>
@ -173,6 +183,7 @@ namespace ResMgr
loader = GetLoader(path); loader = GetLoader(path);
if (!string.IsNullOrEmpty(loader.FullPath)) if (!string.IsNullOrEmpty(loader.FullPath))
{ {
Log(path, "Load AB name:" + path);
bundleMap.Add(path, loader); bundleMap.Add(path, loader);
string[] dependences = manifest.GetAllDependencies(path); string[] dependences = manifest.GetAllDependencies(path);
loader.LoadAssetBundle(); loader.LoadAssetBundle();
@ -308,6 +319,7 @@ namespace ResMgr
if (!loader.IsLoadFinish || loader.IsGlobal) continue; if (!loader.IsLoadFinish || loader.IsGlobal) continue;
if (loader.IsFree) { if (loader.IsFree) {
loader.LifeTime = 0; loader.LifeTime = 0;
Log(loader.Path, "AB loader UnLoad, UnUsed: " + loader.Path);
unLoadList.Add(loader); unLoadList.Add(loader);
} }
} }
@ -341,6 +353,7 @@ namespace ResMgr
AssetBundleLoader loader = null; AssetBundleLoader loader = null;
if (bundleMap.TryGetValue(path, out loader)) if (bundleMap.TryGetValue(path, out loader))
{ {
Log(loader.Path, "UnLoadAssetBundle: " + path);
bundleMap.Remove(path); bundleMap.Remove(path);
loader.UnLoad(isForce); loader.UnLoad(isForce);
loaderPool.CollectOne(loader.gameObject); loaderPool.CollectOne(loader.gameObject);

View File

@ -208,7 +208,11 @@ namespace ResMgr {
resData.RefCount--; resData.RefCount--;
if (resData.RefCount <= 0) if (resData.RefCount <= 0)
{ {
resMap.Remove(name); if (resData.RefCount == 0)
{
Debug.LogWarning("UnLoadAsset:" + name + ", Count:" + resData.RefCount);
}
resMap.Remove(name);
resData.UnLoad(); resData.UnLoad();
resDataPool.Release(resData); resDataPool.Release(resData);
} }
@ -224,9 +228,13 @@ namespace ResMgr {
if (resMap.TryGetValue(name, out resData)) if (resMap.TryGetValue(name, out resData))
{ {
resData.RefCount -= count; resData.RefCount -= count;
//Debug.LogWarning("UnLoadAsset:" + name + ", Count:" + resData.RefCount);
if (resData.RefCount <= 0) if (resData.RefCount <= 0)
{ {
if(resData.RefCount == 0)
{
Debug.LogWarning("UnLoadAsset:" + name + ", Count:" + resData.RefCount);
}
resMap.Remove(name); resMap.Remove(name);
resData.UnLoad(); resData.UnLoad();
resDataPool.Release(resData); resDataPool.Release(resData);

View File

@ -171,6 +171,13 @@ namespace ResMgr
ab.Unload(true); ab.Unload(true);
} }
private void Log(string name, string con)
{
if (name.Equals("shadow_4"))
{
Debug.LogWarning(con);
}
}
/// <summary> /// <summary>
/// 加载资源 /// 加载资源
/// </summary> /// </summary>
@ -189,7 +196,7 @@ namespace ResMgr
if (resMap.TryGetValue(name, out resData)) if (resMap.TryGetValue(name, out resData))
{ {
resData.RefCount++; resData.RefCount++;
Debug.Log("LoadAsset add:" + name + ", Count:" + resData.RefCount); Log(name, "LoadAsset add:" + name + ", Count:" + resData.RefCount);
asset = resData.Asset as T; asset = resData.Asset as T;
} }
else else
@ -204,7 +211,7 @@ namespace ResMgr
resData = resDataPool.Get(); resData = resDataPool.Get();
resData.Name = name; resData.Name = name;
resData.RefCount++; resData.RefCount++;
Debug.Log("LoadAsset new:" + name + ", Count:" + resData.RefCount); Log(name, "LoadAsset new:" + name + ", Count:" + resData.RefCount);
resMap.Add(name, resData); resMap.Add(name, resData);
asset = loader.LoadAsset<T>(name); asset = loader.LoadAsset<T>(name);
resData.LoadSuccess(loader, asset); resData.LoadSuccess(loader, asset);
@ -338,13 +345,9 @@ namespace ResMgr
if (resMap.TryGetValue(name, out resData)) if (resMap.TryGetValue(name, out resData))
{ {
resData.RefCount--; resData.RefCount--;
//Debug.LogWarning("UnLoadAsset:" + name + ", Count:" + resData.RefCount); Log(name, "UnLoadAsset:" + name + ", Count:" + resData.RefCount);
if (resData.RefCount <= 0) if (resData.RefCount <= 0)
{ {
if (resData.RefCount == 0)
{
Debug.LogWarning("UnLoadAsset:" + name + ", Count:" + resData.RefCount);
}
resMap.Remove(name); resMap.Remove(name);
resData.UnLoad(); resData.UnLoad();
resDataPool.Release(resData); resDataPool.Release(resData);
@ -361,13 +364,9 @@ namespace ResMgr
if (resMap.TryGetValue(name, out resData)) if (resMap.TryGetValue(name, out resData))
{ {
resData.RefCount -= count; resData.RefCount -= count;
//Debug.LogWarning("UnLoadAsset:" + name + ", Count:" + resData.RefCount); Log(name, "UnLoadAsset:" + name + ", Count:" + resData.RefCount);
if (resData.RefCount <= 0) if (resData.RefCount <= 0)
{ {
if (resData.RefCount == 0)
{
Debug.LogWarning("UnLoadAsset:" + name + ", Count:" + resData.RefCount);
}
resMap.Remove(name); resMap.Remove(name);
resData.UnLoad(); resData.UnLoad();
resDataPool.Release(resData); resDataPool.Release(resData);
@ -389,7 +388,7 @@ namespace ResMgr
if (!resData.IsFinish) continue; if (!resData.IsFinish) continue;
if (resData.RefCount != 0) continue; if (resData.RefCount != 0) continue;
Debug.LogWarning("UnLoadAsset:" + resData.Name + ", unUse"); Log(resData.Name, "UnLoadAsset:" + resData.Name + ", unUse");
resMap.Remove(resData.Name); resMap.Remove(resData.Name);
resData.UnLoad(); resData.UnLoad();
resDataPool.Release(resData); resDataPool.Release(resData);