public bool TryGetBundleInfo(string bundleName, out BuildBundleInfo result) { foreach (var bundleInfo in BundleInfos) { if (bundleInfo.BundleName == bundleName) { result = bundleInfo; return(true); } } result = null; return(false); }
/// <summary> /// 添加一个打包资源 /// </summary> public void PackAsset(BuildAssetInfo assetInfo) { string bundleName = assetInfo.GetBundleName(); if (string.IsNullOrEmpty(bundleName)) { throw new Exception("Should never get here !"); } if (TryGetBundleInfo(bundleName, out BuildBundleInfo bundleInfo)) { bundleInfo.PackAsset(assetInfo); } else { BuildBundleInfo newBundleInfo = new BuildBundleInfo(bundleName); newBundleInfo.PackAsset(assetInfo); BundleInfos.Add(newBundleInfo); } }