Esempio n. 1
0
        /// <summary>
        /// 构建需要打包的资源的路径、包名以及包的后缀
        /// </summary>
        public List <AssetBundleBuild> AssetbundleEntry_Building()
        {
            this.ABEntries = this.GenerateABEntries();
            if (ABEntries == null)
            {
                ABEntries = new List <ABEntry>();
            }

            // 资源预处理
            List <ABEntryProcessor> rABEntryProcessors = new List <ABEntryProcessor>();

            foreach (var rEntry in ABEntries)
            {
                ABEntryProcessor rProcessor = ABEntryProcessor.Create(rEntry);
                rProcessor.PreprocessAssets();
                rProcessor.ProcessAssetBundleLabel();
                rABEntryProcessors.Add(rProcessor);
            }
            // 打包
            List <AssetBundleBuild> rABBList = new List <AssetBundleBuild>();

            foreach (var rProcessor in rABEntryProcessors)
            {
                rABBList.AddRange(rProcessor.ToABBuild());
            }
            return(rABBList);
        }
Esempio n. 2
0
        /// <summary>
        /// 根据不同的类名构建不同的资源预处理器
        /// </summary>
        public static ABEntryProcessor Create(ABEntry rABEntry)
        {
            ABEntryProcessor rEntryProcessor = null;

            Type rType = Type.GetType(rABEntry.abClassName);

            if (rType == null)
            {
                rEntryProcessor = new ABEntryProcessor();
            }
            else
            {
                rEntryProcessor = ReflectionAssist.Construct(rType) as ABEntryProcessor;
            }

            rEntryProcessor.Entry = rABEntry;

            return(rEntryProcessor);
        }
Esempio n. 3
0
        public void UpdateAllAssetsABLabels(string aBEntryConfigPath)
        {
            this.ABEntries = this.GenerateABEntries();
            if (ABEntries == null)
            {
                ABEntries = new List <ABEntry>();
            }

            // 资源预处理
            List <ABEntryProcessor> rABEntryProcessors = new List <ABEntryProcessor>();

            foreach (var rEntry in ABEntries)
            {
                ABEntryProcessor rProcessor = ABEntryProcessor.Create(rEntry);
                rProcessor.PreprocessAssets();
                rProcessor.ProcessAssetBundleLabel();
                rABEntryProcessors.Add(rProcessor);
            }
            AssetDatabase.RemoveUnusedAssetBundleNames();
        }