Beispiel #1
0
        public static void CollectMainFilter(AssetBundleFilterMain filter, ref AssetBundleCollector collector)
        {
            AssetBundleCollector mainCollector = new AssetBundleCollector();
            AssetBundleCollector subCollector  = new AssetBundleCollector();
            AssetBundleFilter    tmpF;

            mainCollector.Collect(filter.option, filter.resType, filter.path, filter.pattern, filter.assetbundleName);
            if (filter.HasSub())
            {
                for (int i = 0; i < filter.subFilterList.Count; ++i)
                {
                    tmpF = filter.subFilterList[i];
                    if (filter.subFilterList[i].isAppend)
                    {
                        subCollector.CollectAppend(mainCollector, tmpF.option, tmpF.resType, tmpF.path, tmpF.pattern, tmpF.assetbundleName, tmpF.independent);
                    }
                    else
                    {
                        subCollector.Collect(tmpF.option, tmpF.resType, tmpF.path, tmpF.pattern, tmpF.assetbundleName);
                    }
                }
            }
            collector.Mearge(mainCollector);
            collector.Mearge(subCollector);
        }
        public static AssetBundleCollector CollectAssetbundlesForEachSubFolder(GameResType type, string path, string pattern, string format = "{0}", SearchOption searchOption = SearchOption.AllDirectories)
        {
            string fullpath = PathUtil.GetFullPath(path);
            AssetBundleCollector assetBundleCollector = new AssetBundleCollector();

            if (!Directory.Exists(fullpath))
            {
                return(assetBundleCollector);
            }

            string[] dirList = Directory.GetDirectories(fullpath);
            List <AssetBundleBuild> bulldList = new List <AssetBundleBuild>();

            foreach (string dir in dirList)
            {
                string               fullPath  = dir.Replace("\\", "/");
                string[]             splitName = PathUtil.splitePath(fullPath);
                string               name      = string.Format(format, splitName);
                AssetBundleCollector abc       = CollectAssetBundlesForFolder(type, PathUtil.GetRelativePathToDataPath(fullPath), pattern, name, searchOption);
                assetBundleCollector.Mearge(abc);
            }
            return(assetBundleCollector);
        }