Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 // 资源清单处理方法
 #region GameRes
 public static void ClearGameRes(AssetBundleBuildConfig config)
 {
     for (int i = 0; i < config.filters.Count; ++i)
     {
         AssetBundleFilterMain filter = config.filters[i];
         if (filter.valid)
         {
             ClearGameRes(filter.resType);
             if (filter.HasSub())
             {
                 for (int j = 0; j < filter.subFilterList.Count; ++j)
                 {
                     ClearGameRes(filter.subFilterList[j].resType);
                 }
             }
         }
     }
 }
        int DrawMainFilter(AssetBundleFilterMain filter)
        {
            GUILayout.BeginHorizontal();
            {
                //--------------------  展开/折叠 --------------------------------
                if (filter.HasSub())
                {
                    if (filter.showSub)
                    {
                        if (GUILayout.Button("◢", GUILayout.ExpandWidth(false), GUILayout.Width(20), GUILayout.Height(15)))
                        {
                            filter.showSub = !filter.showSub;
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("▶", GUILayout.ExpandWidth(false), GUILayout.Width(20), GUILayout.Height(15)))
                        {
                            filter.showSub = !filter.showSub;
                        }
                    }
                }
                else
                {
                    GUILayout.Space(27);
                }

                // 勾选框
                filter.valid = GUILayout.Toggle(filter.valid, "", GUILayout.ExpandWidth(false));

                // 文件夹/文件
                filter.target = EditorGUILayout.ObjectField(filter.target, filter.target.GetType(), GUILayout.MinWidth(150));

                // 通用内容
                DrawContent(filter);

                // filter.searchOption = (SearchOption)EditorGUILayout.EnumPopup(filter.searchOption, GUILayout.MinWidth(120), GUILayout.ExpandWidth(false));

                // 添加子筛选器
                if (GUILayout.Button("+", GUILayout.ExpandWidth(false), GUILayout.Width(20), GUILayout.Height(15)))
                {
                    filter.AddSubFilter(new AssetBundleFilter());
                }

                // 删除
                if (GUILayout.Button("X", GUILayout.ExpandWidth(false), GUILayout.Width(20), GUILayout.Height(15)))
                {
                    config.filters.Remove(filter);
                    return(1);
                }
            }
            GUILayout.EndHorizontal();

            // 显示子筛选器
            if (filter.IsShowSub())
            {
                for (int i = 0; i < filter.subFilterList.Count; ++i)
                {
                    i -= DrawFilter(filter, filter.subFilterList[i]);
                }
            }

            return(0);
        }