private static void _PreProcessSpecialBundle() { BundleData shader = BundleDataManager.GetBundleData(BundleName.BN_SHADER); if (shader == null) { BundleDataManager.CreateNewBundle(BundleName.BN_SHADER, "", BundleType.None, BundleLoadState.UnLoadOnUnloadAsset); shader = BundleDataManager.GetBundleData(BundleName.BN_SHADER); } if (shader.children.Count == 0) { string name = BundleDataManager.GenBundleNameByType(BundleType.Shader); BundleDataManager.CreateNewBundle(name, shader.name, BundleType.Shader, BundleLoadState.PreLoad); } _AddToDict(shader.name, m_bundleDict); BundleData script = BundleDataManager.GetBundleData(BundleName.BN_SCRIPT); if (script == null) { BundleDataManager.CreateNewBundle(BundleName.BN_SCRIPT, "", BundleType.None, BundleLoadState.UnLoadOnUnloadAsset); script = BundleDataManager.GetBundleData(BundleName.BN_SCRIPT); } if (script.children.Count == 0) { string name = BundleDataManager.GenBundleNameByType(BundleType.Script); BundleDataManager.CreateNewBundle(name, script.name, BundleType.Script, BundleLoadState.PreLoad); } _AddToDict(script.name, 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); }