【白片】添加一些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
end
resMgr:UnLoadAsset(sub.assetName)
LogError("sub UI close: "..sub.assetName)
end

View File

@ -679,15 +679,6 @@ function UIManager.DoLanguageCheck(spLoader, gameObject)
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
@ -749,6 +740,7 @@ function UIManager.DelayDestroyPanel(panel)
end
function UIManager.DestroyPanel(panel)
LogError("Panel Destroy: "..panel.uiConfig.assetName)
panel:DestroyUI()
GameObject.Destroy(panel.gameObject)
resMgr:UnLoadAsset(panel.uiConfig.assetName)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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