void BuildAB(BuildTarget target, bool rebuild) { EditorCoroutine.Run(BuildScript.BuildAssetBundle(target, rebuild, () => { if (mTarget.BuildScene) { BuildScript.BuildStreamingScene(target); } BuildScript.GenBundleManifest(target); BuildScript.GenVersionFile(target); mTarget.Groups.Sort((a, b) => b.Size.CompareTo(a.Size)); })); }
void DrawBundleConfig(GUILayoutOption[] guiOpts) { // build GUILayout.Space(1f); { var rect = EditorGUILayout.GetControlRect(); var rebuild = mTarget.ForceRebuild; var sn = 5; var idx = -1; if (GUI.Button(rect.Split(++idx, sn), "BuildWin")) { BuildAB(BuildTarget.StandaloneWindows, rebuild); } if (GUI.Button(rect.Split(++idx, sn), "BuildAnd")) { BuildAB(BuildTarget.Android, rebuild); } if (GUI.Button(rect.Split(++idx, sn), "BuildiOS")) { BuildAB(BuildTarget.iOS, rebuild); } if (GUI.Button(rect.Split(++idx, sn), "BuildMac")) { BuildAB(BuildTarget.StandaloneOSX, rebuild); } } // clean GUILayout.Space(1f); { var rect = EditorGUILayout.GetControlRect(); var sn = 5; var idx = -1; if (GUI.Button(rect.Split(++idx, sn), "CleanWin")) { Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.StandaloneWindows), true); } if (GUI.Button(rect.Split(++idx, sn), "CleanAnd")) { Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.Android), true); } if (GUI.Button(rect.Split(++idx, sn), "CleaniOS")) { Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.iOS), true); } if (GUI.Button(rect.Split(++idx, sn), "CleanMac")) { Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.iOS), true); } } // update prefab lua path GUILayout.Space(1f); { var rect = EditorGUILayout.GetControlRect(); var sn = 4; var idx = -1; if (GUI.Button(rect.Split(++idx, sn), "Refresh")) { Refresh(); } if (GUI.Button(rect.Split(++idx, sn), "FixPrefabLuaPath")) { EditorCoroutine.Run(FixPrefabLuaPath()); } } EditorGUILayout.LabelField("LastBuildTime", DateTime.FromFileTime(mTarget.LastBuildTime).ToString("yyyy/MM/dd HH:mm:ss")); mTarget.ForceRebuild = EditorGUILayout.Toggle("ForceRebuild", mTarget.ForceRebuild, guiOpts); mTarget.BuildScene = EditorGUILayout.Toggle("BuildScene", mTarget.BuildScene, guiOpts); mTarget.BundleBuildOptions = (BuildConfig.BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField("BundleBuildOptions", mTarget.BundleBuildOptions); ++EditorGUI.indentLevel; foreach (var i in mTarget.Groups) { i.DrawGroup(0, guiOpts); } --EditorGUI.indentLevel; }