/// <summary> /// 根据项目中的配置进行AB打包 /// </summary> /// <param name="assetBundleManifest"></param> /// <param name="setting"><see cref="PackBundleSetting"/></param> /// <returns></returns> public static bool PackBundle(out AssetBundleManifest assetBundleManifest, PackBundleSetting setting) { assetBundleManifest = null; if (setting.UpdateConfigs) { if (!GenerateConfigs()) { return(false); } if (setting.FindDepend) { FindAndAddAutoGroup(setting.IsShowProgressBar); } else { DeleteAutoGroup(); } } if (setting.ResetBundleName) { ClearAssetBundleNames(setting.IsShowProgressBar); SetAssetBundleNames(setting.IsShowProgressBar); } BundlePackConfig packConfig = Util.FileUtil.ReadFromBinary <BundlePackConfig>(BundlePackUtil.GetPackConfigPath()); assetBundleManifest = PackAssetBundle(packConfig); return(true); }
public override void MakeEditUI(object target) { GOEPackV5 pack = target as GOEPackV5; if (null == pack) { return; } GUILayout.BeginVertical(); //打包// MakeMultipleActionUI(); if (GUILayout.Button("打包")) { string error; Dictionary <string, object> e; AssetBundleManifest buildManifest; DoPack(false, getBestPackOrder()[0], out error, null, out e, out buildManifest); } //打包项编辑// GUILayout.Label("编辑Bundles"); for (int i = 0; i < pack.PackItems.Count; i++) { PackBundleSetting bundle = pack.PackItems[i]; GUILayout.BeginHorizontal(); if (GUILayout.Button("X", GUILayout.Width(20))) {//两个宽度30的按钮=一个宽度64的按钮// //删除打包项// pack.PackItems.RemoveAt(i); } GUILayout.Label(bundle.BundleName); //todo:如类型为场景则提供逐个打包选项// if (bundle.PackType == "Scene") { //if (GUILayout.Button("列举场景", GUILayout.Width(140))) //{ // lastDetailBundle = bundle; // lastDetailList = bundle.BuildSrcFileList(pack.SrcDir); //} //GUILayout.EndHorizontal(); //if (lastDetailBundle == bundle) //{ // foreach (string scn in lastDetailList) // { // string scnFN = Path.GetFileName(scn); // if (GUILayout.Button(scnFN)) // { // DoPackScene(scn); // } // } //} } else { GUILayout.EndHorizontal(); } } //添加// if (GUILayout.Button("添加Bundle", GUILayout.Width(140))) { pack.PackItems.Add(new PackBundleSetting()); //更新属性窗口// JsonObjectPropertyWindow wp = EditorWindow.GetWindow(typeof(JsonObjectPropertyWindow), false, "Property") as JsonObjectPropertyWindow; wp.Show(); wp.SetCurStringInterface(pack, this); } GUILayout.EndVertical(); }