/// <summary> /// 构建需要打包的资源的路径、包名以及包的后缀 /// </summary> public List <AssetBundleBuild> AssetbundleEntry_Building() { this.ABEntries = this.GenerateABEntries(); if (ABEntries == null) { ABEntries = new List <ABEntry>(); } // 预处理图集配置 ABUIAtlasTools.GenerateAtlas(); // 资源预处理 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); }
/// <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); }
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(); }
/// <summary> /// 根据不同的类名构建不同的资源预处理器 /// </summary> public static ABEntryProcessor Create(ABEntry rABEntry) { ABEntryProcessor rEntryProcessor = null; Type rType = Type.GetType(rABEntry.abClassName); if (rType == null) { var rAllAssembies = System.AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < rAllAssembies.Length; i++) { if (rAllAssembies[i].GetName().Name.Equals("Game.Editor")) { var rAllTypes = rAllAssembies[i].GetTypes(); for (int j = 0; j < rAllTypes.Length; j++) { if (rAllTypes[j].FullName.Equals(rABEntry.abClassName)) { rType = rAllTypes[j]; } } } } } if (rType == null) { rEntryProcessor = new ABEntryProcessor(); } else { rEntryProcessor = ReflectionAssist.Construct(rType) as ABEntryProcessor; } rEntryProcessor.Entry = rABEntry; return(rEntryProcessor); }