private static void _ProcessDependBundleList() { bool loop = true; while (loop) { loop = false; List <string> list = new List <string>(m_bundleDict.Keys); for (int i = 0; i < list.Count; ++i) { bool isProcess = false; if (!m_bundleDict.TryGetValue(list[i], out isProcess)) { continue; } if (isProcess) { continue; } m_bundleDict[list[i]] = true; loop = true; BundleData data = BundleDataManager.GetBundleData(list[i]); if (data == null) { continue; } for (int j = 0; j < data.includs.Count; ++j) { string[] dep = AssetDepend.GetDependenciesCache(data.includs[j]); for (int k = 0; k < dep.Length; ++k) { string bundleName = BundleDataManager.GetPathBundleName(dep[k]); if (!string.IsNullOrEmpty(bundleName)) { _AddToDict(bundleName, m_bundleDict); } } } } } }
private static void _AddPathToBundleByPathConfig(BundleImportData data, string path) { if (data == null || string.IsNullOrEmpty(path) || BundleDataManager.CheckPathInBundle(path)) { return; } string parentName = BundleDataManager.GetIndexBundleName(data.Index); if (data.Type == BundleType.Shader) { parentName = BundleName.BN_SHADER; } string bundleName = BundleDataManager.GetPathBundleName(path); if (!string.IsNullOrEmpty(bundleName)) { BundleData bundleData = BundleDataManager.GetBundleData(bundleName); if (bundleData.parent == parentName) { return; } else { BundleDataManager.RemovePathFromBundle(path, bundleName); } } _AddToDict(bundleName, m_bundleDict); BundleData parent = BundleDataManager.GetBundleData(parentName); if (parent == null) { BundleDataManager.CreateNewBundle(parentName, "", BundleType.None, BundleLoadState.UnLoadOnUnloadAsset); parent = BundleDataManager.GetBundleData(parentName); } string name = ""; for (int i = 0; i < parent.children.Count; ++i) { int index = parent.children.Count - i - 1; BundleData child = BundleDataManager.GetBundleData(parent.children[index]); if (BundleDataManager.IsBundleFull(child, data.LimitCount, data.LimitKBSize * 1024)) { continue; } if (data.Publish && BundleDataManager.IsNameDuplicatedAsset(child, path)) { continue; } name = child.name; break; } if (string.IsNullOrEmpty(name)) { name = BundleDataManager.GenBundleNameByType(data.Type); BundleDataManager.CreateNewBundle(name, parent.name, data.Type, data.LoadState); } long size = CalcPathFileSize(path, data.Type); BundleDataManager.AddPathToBundle(path, name, size); _AddToDict(name, m_bundleDict); }