private void AssetsPoolGUI() { AssetsPoolManager.triggerUnloadNumber = (int)EditorDrawGUIUtil.DrawBaseValue("回收触发数量", AssetsPoolManager.triggerUnloadNumber); AssetsPoolManager.unloadDelayTime = (float)EditorDrawGUIUtil.DrawBaseValue("回收时间间隔", AssetsPoolManager.unloadDelayTime); if (AssetsPoolManager.unloadDelayTime <= 0) { AssetsPoolManager.unloadDelayTime = 0.05f; } EditorDrawGUIUtil.DrawScrollView(this, () => { GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); DataDetail(); Dictionary <string, AssetLoadInfo> loadedAssets = AssetsPoolManager.GetLoadedAssets(); GUILayout.Box("加载记录(" + loadedAssets.Count + "):"); foreach (var item in assetsInfos) { DrawTypeAssets(item.Key, item.Value); } GUILayout.EndVertical(); // GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); List <AssetLoadInfo> reCover = AssetsPoolManager.GetRecycleAssets(); GUILayout.Box("回收池记录(" + reCover.Count + "):"); foreach (var item in recycleAssetsInfos) { DrawTypeAssets(item.Key, item.Value); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); }); }
private void OnGUI() { GUILayout.Box("内存占用:" + MemoryManager.totalAllocatedMemory.ToString("F") + "MB"); EditorDrawGUIUtil.DrawScrollView(this, () => { GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); Dictionary <string, int> loadedAssets = AssetsPoolManager.GetLoadedAssets(); GUILayout.Box("加载记录:"); foreach (var item in loadedAssets) { GUILayout.Label(" =>" + item.Key + " : " + item.Value); } GUILayout.EndVertical(); // GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); List <string> reCover = AssetsPoolManager.GetRecycleAssets(); GUILayout.Box("回收池记录(" + reCover.Count + "):"); foreach (var item in reCover) { GUILayout.Label(" ==>>" + item); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); }); }
private void DataDetail() { foreach (var item in assetsInfos) { item.Value.Clear(); } Dictionary <string, AssetLoadInfo> loadedAssets = AssetsPoolManager.GetLoadedAssets(); foreach (var item in loadedAssets) { if (assetsInfos.ContainsKey(item.Value.assetType)) { assetsInfos[item.Value.assetType].Add(item.Value); } else { assetsInfos.Add(item.Value.assetType, new List <AssetLoadInfo>() { item.Value }); } } foreach (var item in recycleAssetsInfos) { item.Value.Clear(); } List <AssetLoadInfo> reCover = AssetsPoolManager.GetRecycleAssets(); foreach (var item in reCover) { if (recycleAssetsInfos.ContainsKey(item.assetType)) { recycleAssetsInfos[item.assetType].Add(item); } else { recycleAssetsInfos.Add(item.assetType, new List <AssetLoadInfo>() { item }); } } }