/// <summary>
        /// 构建需要打包的资源的路径、包名以及包的后缀
        /// </summary>
        private List <AssetBundleBuild> AssetbundleEntry_Building()
        {
            JsonNode rRootNode = JsonParser.Parse(File.ReadAllText(ABEntriesConfigPath));

            //Debug.Log(rRootNode.ToString());
            if (rRootNode == null)
            {
                return(new List <AssetBundleBuild>());
            }

            abEntries = rRootNode.ToDict <string, ABEntry>();
            if (abEntries == null)
            {
                abEntries = new Dict <string, ABEntry>();
            }

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

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

            foreach (var rProcessor in rABEntryProcessors)
            {
                rABBList.AddRange(rProcessor.ToABBuild());
            }
            return(rABBList);
        }
Exemple #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();
            }

            rEntryProcessor       = ReflectionAssist.Construct(rType) as ABEntryProcessor;
            rEntryProcessor.Entry = rABEntry;

            return(rEntryProcessor);
        }