private void RefreshAssetBundleTree() { m_AssetBundleRoot.Clear(); AssetBundle[] assetBundles = m_Controller.GetAssetBundles(); foreach (AssetBundle assetBundle in assetBundles) { string[] splitedPath = assetBundle.Name.Split('/'); AssetBundleFolder folder = m_AssetBundleRoot; for (int i = 0; i < splitedPath.Length - 1; i++) { AssetBundleFolder subFolder = folder.GetFolder(splitedPath[i]); folder = subFolder == null?folder.AddFolder(splitedPath[i]) : subFolder; } string assetBundleFullName = assetBundle.Variant != null?Utility.Text.Format("{0}.{1}", splitedPath[splitedPath.Length - 1], assetBundle.Variant) : splitedPath[splitedPath.Length - 1]; folder.AddItem(assetBundleFullName, assetBundle); } }
//刷新树状列表 private void RefreshAssetBundleTree() { m_AssetBundleRoot.Clear(); AssetBundleInfo[] assetBundleInfos = m_Controller.GetAssetBundleInfos(); foreach (AssetBundleInfo assetBundleInfo in assetBundleInfos) { string[] splitPath = assetBundleInfo.Name.Split('/'); AssetBundleFolder folder = m_AssetBundleRoot; for (int i = 0; i < splitPath.Length - 1; i++) { AssetBundleFolder subFolder = folder.GetFolder(splitPath[i]); //获取存在的子文件夹 folder = subFolder == null?folder.AddFolder(splitPath[i]) : subFolder; //不存在则添加 } //最后添加Bundle全名 string assetBundleFullName = assetBundleInfo.Variant != null?Utility.Text.Format("{0}.{1}", splitPath[splitPath.Length - 1], assetBundleInfo.Variant) : splitPath[splitPath.Length - 1]; folder.AddItem(assetBundleFullName, assetBundleInfo); //添加Bundle资源项 } }