コード例 #1
0
 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);
 }
コード例 #2
0
        /// <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);
            }
        }