void GUIVersionList() { using (var header = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(true, new GUIContent("Version".Localization()))) { if (header.Visiable) { if (versionList == null) { List <AssetBundleVersion> list = new List <AssetBundleVersion>(); string dir = BuildAssetBundles.GetOutputPath(); if (File.Exists(dir)) { foreach (var file in Directory.GetFiles(dir, AssetBundleSettings.VersionFile, SearchOption.AllDirectories)) { try { var item = JsonUtility.FromJson <AssetBundleVersion>(File.ReadAllText(file, Encoding.UTF8)); if (item != null) { list.Add(item); } } catch { } } } versionList = list.ToArray(); } if (versionList.Length > 0) { using (var sv = new GUILayout.ScrollViewScope(versionListScrollPos, GUILayout.MinHeight(0), GUILayout.MaxHeight(200))) { versionListScrollPos = sv.scrollPosition; using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { foreach (var g in versionList.OrderByDescending(o => o.bundleCode) .OrderByDescending(o => Version.Parse(o.appVersion)) .GroupBy(o => o.bundleCode) .ToArray()) { GUILayout.Label(new GUIContent(g.Key.ToString(), "Bundle Code".Localization())); foreach (var item in g) { using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) using (var checker = new EditorGUI.ChangeCheckScope()) { //using (new GUILayout.HorizontalScope()) //{ // GUILayout.Label(item.platform); // GUILayout.FlexibleSpace(); // GUILayout.Label(item.Timestamp.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GUILayout.ExpandWidth(false)); // if (GUILayout.Button("Delete".Localization(), GUILayout.ExpandWidth(false))) // { // if (EditorUtility.DisplayDialog("Delete".Localization(), "Delete".Localization() + $" {item.platform} <{item.bundleCode}>", "ok".Localization(), "cancel".Localization())) // { // remove = item; // } // } //} using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("App Version".Localization()); GUILayout.Label(item.appVersion.ToString()); } EditorGUILayout.LabelField("Hash".Localization(), item.hash); EditorGUILayout.LabelField("Commit Id".Localization(), item.commitId); //using (new GUILayout.HorizontalScope()) //{ // EditorGUILayout.PrefixLabel("Build Time".Localization()); // GUILayout.Label(item.Timestamp.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")); //} } } } } } } } else { GUILayout.Label("no version, generate menu <Build/Build AssetBundle>"); } } } //if (remove != null) //{ // //BuildAssetBundles.RemoveRootVersion(remove); // string outputPath = BuildAssetBundles.GetOutputPath(remove); // if (Directory.Exists(outputPath)) // { // Directory.Delete(outputPath, true); // BuildAssetBundles.DeleteOutputEmptyDirectory(outputPath); // } // versionList = null; //} }
private void OnGUI() { //BuildAssetBundleSettings config = Config; using (EditorAssetBundles.EditorLocalizationValues.BeginScope()) { using (new GUILayout.HorizontalScope()) { //GUILayout.Label("Mode".Localization(), GUILayout.ExpandWidth(false)); EditorAssetBundles.Mode = (AssetBundleMode)EditorGUILayout.EnumPopup(EditorAssetBundles.Mode, GUILayout.ExpandWidth(false)); if (GUILayout.Button("Release".Localization())) { BuildAssetBundles.Release(); } if (GUILayout.Button("Build".Localization())) { BuildAssetBundles.Build(); } } using (new GUILayout.HorizontalScope()) { if (GUILayout.Button("Refresh".Localization())) { BuildAssetBundles.UpdateAllAssetBundleNames(); } if (GUILayout.Button("Remove Unused Bundle Names".Localization())) { EditorAssetBundles.RemoveUnusedAssetBundleNames(); } if (GUILayout.Button("gen AssetBundleNames.dll".Localization())) { BuildAssetBundles.GenerateAssetBundleNamesClass(); } if (GUILayout.Button("Delete All Crypto".Localization())) { BuildAssetBundles.DeleteAllCryptoOrSignatureBuildAssetBundle(); } } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Open Directory".Localization()); if (GUILayout.Button("Local".Localization())) { EditorAssetBundles.OpenLocalDirectory_Menu(); } if (GUILayout.Button("StreamingAssets")) { EditorAssetBundles.OpenStreamingAssetsDirectory_Menu(); } if (GUILayout.Button("Output".Localization())) { EditorAssetBundles.OpenBuildDirectory_Menu(); } } GUIVersionList(); using (var sv = new GUILayout.ScrollViewScope(scrollPos)) using (var checker = new EditorGUI.ChangeCheckScope()) using (var enabledScope = new EditorGUILayout.ToggleGroupScope(new GUIContent("Enabled".Localization()), EditorAssetBundleSettings.Enabled)) { scrollPos = sv.scrollPosition; EditorAssetBundleSettings.Enabled = enabledScope.enabled; ShowAdvancedOptions = EditorGUILayout.Toggle("Show Advanced Options".Localization(), ShowAdvancedOptions); EditorAssetBundleSettings.Options = (BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField(new GUIContent("Options".Localization()), EditorAssetBundleSettings.Options); AssetBundleSettings.BundleVersion = EditorGUILayout.DelayedTextField(new GUIContent("Bundle Version".Localization()), AssetBundleSettings.BundleVersion ?? string.Empty); AssetBundleSettings.Channel = EditorGUILayout.DelayedTextField(new GUIContent("Channel".Localization()), AssetBundleSettings.Channel ?? string.Empty); if (ShowAdvancedOptions) { AssetBundleSettings.BuildManifestPath = new GUIContent("Build Path".Localization()).FolderField(AssetBundleSettings.BuildManifestPath ?? string.Empty, "AssetBundle Build Path", relativePath: "."); AssetBundleSettings.StreamingAssetsManifestPath = new GUIContent("StreamingAssets Path".Localization()).FolderField(AssetBundleSettings.StreamingAssetsManifestPath ?? string.Empty, "StreamingAssets Path", relativePath: "."); EditorAssetBundleSettings.StreamingAssetsExcludeGroup = EditorGUILayout.DelayedTextField(new GUIContent("StreamingAssets Exclude Group".Localization()), EditorAssetBundleSettings.StreamingAssetsExcludeGroup ?? string.Empty); AssetBundleSettings.LocalManifestPath = EditorGUILayout.DelayedTextField(new GUIContent("Local Path".Localization()), AssetBundleSettings.LocalManifestPath ?? string.Empty); } EditorAssetBundleSettings.AssetBundleName = EditorGUILayout.DelayedTextField(new GUIContent("AssetBundle Name".Localization()), EditorAssetBundleSettings.AssetBundleName ?? string.Empty); using (new GUILayout.HorizontalScope()) { EditorAssetBundleSettings.AssetName = EditorGUILayout.DelayedTextField(new GUIContent("Asset Name".Localization()), EditorAssetBundleSettings.AssetName ?? string.Empty); GUILayout.Label("Lower".Localization(), GUILayout.ExpandWidth(false)); EditorAssetBundleSettings.AssetNameToLower = GUILayout.Toggle(EditorAssetBundleSettings.AssetNameToLower, GUIContent.none, GUILayout.ExpandWidth(false)); } if (ShowAdvancedOptions) { using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel(new GUIContent("App Version Format".Localization())); AssetBundleSettings.AppVersionFormat = EditorGUILayoutx.DelayedPlaceholderField(AssetBundleSettings.AppVersionFormat ?? string.Empty, new GUIContent("{0}.{1}.{2}")); } AssetBundleSettings.VersionFile = EditorGUILayout.DelayedTextField(new GUIContent("Version File".Localization()), AssetBundleSettings.VersionFile ?? string.Empty); EditorAssetBundleSettings.BundleCodeResetOfAppVersion = EditorGUILayout.Toggle(new GUIContent("BundleCode Reset Of AppVersion".Localization(), "BundleCode Reset Of AppVersion".Localization()), EditorAssetBundleSettings.BundleCodeResetOfAppVersion); if (EditorAssetBundleSettings.AssetBundleNamesClass == null) { EditorAssetBundleSettings.AssetBundleNamesClass = new EditorAssetBundleSettings.AssetBundleNamesClassSettings(); } using (var tg = new EditorGUILayout.ToggleGroupScope("AssetBundleNames Class".Localization(), EditorAssetBundleSettings.AssetBundleNamesClassSettings.Enabled)) { EditorGUI.indentLevel++; using (new GUILayout.VerticalScope()) { EditorAssetBundleSettings.AssetBundleNamesClassSettings.Enabled = tg.enabled; EditorAssetBundleSettings.AssetBundleNamesClassSettings.FilePath = EditorGUILayout.DelayedTextField("File Path".Localization(), EditorAssetBundleSettings.AssetBundleNamesClassSettings.FilePath); EditorAssetBundleSettings.AssetBundleNamesClassSettings.AssetNameClass = EditorGUILayout.DelayedTextField("Asset Name Class".Localization(), EditorAssetBundleSettings.AssetBundleNamesClassSettings.AssetNameClass); } EditorGUI.indentLevel--; } } using (new GUILayout.HorizontalScope()) { var obj = (AssetBundleGroup)EditorGUILayout.ObjectField("Local Group".Localization(), EditorAssetBundleSettings.LocalGroup.Asset, typeof(AssetBundleGroup), false); if (EditorAssetBundleSettings.LocalGroup.Asset != obj) { var v = EditorAssetBundleSettings.LocalGroup; v.Asset = obj; EditorAssetBundleSettings.LocalGroup = v; } if (!EditorAssetBundleSettings.LocalGroup) { if (GUILayout.Button("Create".Localization(), GUILayout.ExpandWidth(false))) { string path = EditorUtility.SaveFilePanel("AssetBundle Group", "Assets", BuildAssetBundles.LocalGroupName, "asset"); if (!string.IsNullOrEmpty(path)) { var asset = ScriptableObject.CreateInstance <AssetBundleGroup>(); asset.items.Add(new AssetBundleGroup.BundleItem()); path = path.Substring(Path.GetFullPath(".").Length + 1); AssetDatabase.CreateAsset(asset, path); EditorAssetBundleSettings.LocalGroup = new AssetObjectReferenced(asset); } } } } if (!EditorAssetBundleSettings.LocalGroup) { EditorGUILayout.HelpBox("Require local group".Localization(), MessageType.Error); } EditorAssetBundleSettings.Groups = new GUIContent("Groups".Localization()).ArrayField(EditorAssetBundleSettings.Groups, (item, index) => { var val = (AssetBundleGroup)EditorGUILayout.ObjectField(item.Asset, typeof(AssetBundleGroup), false); if (val != item.Asset) { item.Asset = val; GUI.changed = true; } return(item); }, initExpand: true) as AssetObjectReferenced[]; using (var g = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(false, new GUIContent("Download".Localization()))) { if (g.Visiable) { using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { AssetBundleSettings.DownloadUrl = EditorGUILayoutx.DelayedPlaceholderField(new GUIContent("Download Url".Localization()), AssetBundleSettings.DownloadUrl, new GUIContent("http://")); AssetBundleSettings.RequireDownload = EditorGUILayout.Toggle("Require Download".Localization(), AssetBundleSettings.RequireDownload); AssetBundleSettings.DownloadManifestPath = EditorGUILayout.DelayedTextField(new GUIContent("Download Manifest Path".Localization()), AssetBundleSettings.DownloadManifestPath ?? string.Empty); AssetBundleSettings.DownloadVersionFile = EditorGUILayout.DelayedTextField(new GUIContent("Download Version File".Localization()), AssetBundleSettings.DownloadVersionFile ?? string.Empty); AssetBundleSettings.ReleasePath = EditorGUILayout.DelayedTextField(new GUIContent("Release Path".Localization()), AssetBundleSettings.ReleasePath ?? string.Empty); } } } if (EditorAssetBundleSettings.PreBuildPlayer == null) { EditorAssetBundleSettings.PreBuildPlayer = new EditorAssetBundleSettings.PreBuildPlayerSettings(); } using (var g = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(false, new GUIContent("Pre Build Player".Localization()))) { if (g.Visiable) { EditorGUI.indentLevel++; using (new GUILayout.VerticalScope()) { EditorAssetBundleSettings.PreBuildPlayerSettings.AutoBuildAssetBundle = EditorGUILayout.Toggle("Auto Build AssetBundle".Localization(), EditorAssetBundleSettings.PreBuildPlayerSettings.AutoBuildAssetBundle); } EditorGUI.indentLevel--; } } if (EditorAssetBundleSettings.PostBuildPlayer == null) { EditorAssetBundleSettings.PostBuildPlayer = new EditorAssetBundleSettings.PostBuildPlayerSettings(); } using (var g = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(false, new GUIContent("Post Build Player".Localization()))) { if (g.Visiable) { EditorGUI.indentLevel++; using (new GUILayout.VerticalScope()) { EditorAssetBundleSettings.PostBuildPlayerSettings.ClearStreamingAssets = EditorGUILayout.Toggle("Clear StreamingAssets".Localization(), EditorAssetBundleSettings.PostBuildPlayerSettings.ClearStreamingAssets); } EditorGUI.indentLevel--; } } if (EditorAssetBundleSettings.PostBuild == null) { EditorAssetBundleSettings.PostBuild = new EditorAssetBundleSettings.PostBuildSettings(); } using (var g = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(false, new GUIContent("Post Build".Localization()))) { if (g.Visiable) { EditorGUI.indentLevel++; using (new GUILayout.VerticalScope()) { EditorAssetBundleSettings.PostBuildSettings.ShowFolder = EditorGUILayout.Toggle("Show Folder".Localization(), EditorAssetBundleSettings.PostBuildSettings.ShowFolder); } EditorGUI.indentLevel--; } } if (EditorAssetBundleSettings.IgnorePaths == null) { EditorAssetBundleSettings.IgnorePaths = new string[0]; } EditorAssetBundleSettings.IgnorePaths = new GUIContent("Exclude Directory".Localization()).ArrayField(EditorAssetBundleSettings.IgnorePaths, (item, index) => { using (new GUILayout.HorizontalScope()) { item = EditorGUILayout.DelayedTextField(item); } return(item); }, createInstance: () => "") as string[]; EditorAssetBundleSettings.ReleasePath = EditorGUILayout.DelayedTextField(new GUIContent("Release Path".Localization()), EditorAssetBundleSettings.ReleasePath); if (EditorAssetBundleSettings.ExcludeExtensions == null) { EditorAssetBundleSettings.ExcludeExtensions = new string[0]; } EditorAssetBundleSettings.ExcludeExtensions = new GUIContent("Exclude Extension".Localization()).ArrayField(EditorAssetBundleSettings.ExcludeExtensions, (item, index) => { item = EditorGUILayout.DelayedTextField(item); return(item); }, createInstance: () => "") as string[]; if (EditorAssetBundleSettings.ExcludeTypeNames == null) { EditorAssetBundleSettings.ExcludeTypeNames = new string[0]; } EditorAssetBundleSettings.ExcludeTypeNames = new GUIContent("Exclude Type Name".Localization()).ArrayField(EditorAssetBundleSettings.ExcludeTypeNames, (item, index) => { item = EditorGUILayout.DelayedTextField(item); return(item); }, createInstance: () => "") as string[]; if (EditorAssetBundleSettings.ExcludeDependencyExtensions == null) { EditorAssetBundleSettings.ExcludeDependencyExtensions = new string[0]; } EditorAssetBundleSettings.ExcludeDependencyExtensions = new GUIContent("Exclude Dependency Extension".Localization()).ArrayField(EditorAssetBundleSettings.ExcludeDependencyExtensions, (item, index) => { return(EditorGUILayout.DelayedTextField(item)); }, createInstance: () => "") as string[]; if (showAdvancedOptions.Value) { using (var g = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(false, new GUIContent("Auto Dependency".Localization()))) { if (g.Visiable) { using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { EditorAssetBundleSettings.AutoDependencyBundleName = EditorGUILayout.DelayedTextField("Bundle Name".Localization(), EditorAssetBundleSettings.AutoDependencyBundleName); EditorAssetBundleSettings.AutoDependencySplit = EditorGUILayout.DelayedIntField("Bundle Split".Localization(), EditorAssetBundleSettings.AutoDependencySplit); } } } } using (var tg = new EditorGUILayout.ToggleGroupScope("Preload".Localization(), AssetBundleSettings.PreloadEnabled)) { AssetBundleSettings.PreloadEnabled = tg.enabled; if (tg.enabled) { EditorGUI.indentLevel++; using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope("box")) { AssetBundleSettings.PreloadInclude = EditorGUILayout.DelayedTextField(new GUIContent("Include".Localization(), "AssetBundle Name"), AssetBundleSettings.PreloadInclude ?? string.Empty); AssetBundleSettings.PreloadExclude = EditorGUILayout.DelayedTextField("Exclude".Localization(), AssetBundleSettings.PreloadExclude ?? string.Empty); } EditorGUI.indentLevel--; } } using (var tg = new EditorGUILayout.ToggleGroupScope("Crypto".Localization(), AssetBundleSettings.CryptoEnabled)) { AssetBundleSettings.CryptoEnabled = tg.enabled; if (tg.enabled) { EditorGUI.indentLevel++; using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope("box")) { EditorAssetBundleSettings.CryptoKey = EditorGUILayoutx.Base64TextField(new GUIContent("Crypto Key".Localization()), EditorAssetBundleSettings.CryptoKey ?? string.Empty, 8); EditorAssetBundleSettings.CryptoIV = EditorGUILayoutx.Base64TextField(new GUIContent("Crypto IV".Localization()), EditorAssetBundleSettings.CryptoIV ?? string.Empty, 8); AssetBundleSettings.CryptoInclude = EditorGUILayout.DelayedTextField(new GUIContent("Include".Localization(), "AssetBundle Name"), AssetBundleSettings.CryptoInclude ?? string.Empty); AssetBundleSettings.CryptoExclude = EditorGUILayout.DelayedTextField("Exclude".Localization(), AssetBundleSettings.CryptoExclude ?? string.Empty); } EditorGUI.indentLevel--; } } using (var tg = new EditorGUILayout.ToggleGroupScope("Signature".Localization(), AssetBundleSettings.SignatureEnabled)) { AssetBundleSettings.SignatureEnabled = tg.enabled; if (tg.enabled) { EditorGUI.indentLevel++; using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope("box")) { string pubKey; EditorAssetBundleSettings.SignatureKeyPath = EditorGUILayoutx.CryptoKeyField(new GUIContent("SignatureKeyPath".Localization()), EditorAssetBundleSettings.SignatureKeyPath ?? string.Empty, out pubKey); if (!string.IsNullOrEmpty(pubKey)) { AssetBundleSettings.SignaturePublicKey = pubKey; } using (new EditorGUI.DisabledGroupScope(!string.IsNullOrEmpty(EditorAssetBundleSettings.SignatureKeyPath))) { AssetBundleSettings.SignaturePublicKey = EditorGUILayout.DelayedTextField(new GUIContent("SignaturePubKey".Localization()), AssetBundleSettings.SignaturePublicKey ?? string.Empty); } AssetBundleSettings.SignatureInclude = EditorGUILayout.DelayedTextField(new GUIContent("Include".Localization(), "AssetBundle Name"), AssetBundleSettings.SignatureInclude ?? string.Empty); AssetBundleSettings.SignatureExclude = EditorGUILayout.DelayedTextField("Exclude".Localization(), AssetBundleSettings.SignatureExclude ?? string.Empty); } EditorGUI.indentLevel--; } } GUILayout.Space(10); if (checker.changed) { //Debug.Log("Changed [" + config.IgnorePaths.Last()+"]"); //Save(); EditorAssetBundleSettings.Provider.Save(); } } } }
public void OnGUI() { using (EditorAssetBundles.EditorLocalizationValues.BeginScope()) { using (new GUILayout.HorizontalScope()) { int selectedIndex = -1; if (groupAssetPath != null) { selectedIndex = Array.IndexOf(allGroupAssetPaths, groupAssetPath); } using (var checker = new EditorGUI.ChangeCheckScope()) { selectedIndex = EditorGUILayout.Popup(selectedIndex, allGroupAssetPaths.Select(o => Path.GetFileNameWithoutExtension(o)).ToArray()); if (checker.changed) { Asset = AssetDatabase.LoadAssetAtPath <AssetBundleGroup>(allGroupAssetPaths[selectedIndex]); } } if (GUILayout.Button("New", GUILayout.ExpandWidth(false))) { CreateAsset(); } } if (!Asset) { return; } string assetPath; asset.IsLocal = EditorGUILayout.Toggle("Local".Localization(), asset.IsLocal); asset.IsDebug = EditorGUILayout.Toggle("Debug".Localization(), asset.IsDebug); //using (new GUILayout.HorizontalScope()) //{ // GUILayout.Label("Items"); // if (GUILayout.Button("+", "label", GUILayout.ExpandWidth(false))) // { // asset.items.Add(new AssetBundleGroup.Item()); // } //} using (var sv = new GUILayout.ScrollViewScope(scrollPos)) using (var checker = new EditorGUI.ChangeCheckScope()) { scrollPos = sv.scrollPosition; asset.items = (List <AssetBundleGroup.BundleItem>) new GUIContent("Items".Localization()).ArrayField(asset.items, (item, index) => //for (int i = 0; i < asset.items.Count; i++) { //using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope("box")) { //AssetBundleGroup.Item item = asset.items[i]; //if (item.includes == null) // item.includes = new string[0]; //item.includes = (string[])EditorGUILayoutx.ArrayField(new GUIContent("Include"), item.includes, (o, index) => // { // return EditorGUILayout.DelayedTextField(o); // }, initExpand: true, createInstance: () => string.Empty); //if (item.excludes == null) // item.excludes = new string[0]; //item.excludes = (string[])EditorGUILayoutx.ArrayField(new GUIContent("Exclude"), item.excludes, (o, index) => //{ // return EditorGUILayout.DelayedTextField(o); //}, initExpand: true, createInstance: () => string.Empty); item.include = EditorGUILayout.DelayedTextField(new GUIContent("Include".Localization()), item.include); if (string.IsNullOrEmpty(item.include)) { EditorGUILayout.HelpBox("Empty".Localization(), MessageType.Error); } item.exclude = EditorGUILayout.DelayedTextField(new GUIContent("Exclude".Localization()), item.exclude); item.bundleName = EditorGUILayoutx.DelayedPlaceholderField(new GUIContent("AssetBundle Name".Localization()), item.bundleName ?? string.Empty, new GUIContent(EditorAssetBundleSettings.AssetBundleName)); using (new GUILayout.HorizontalScope()) { item.assetName = EditorGUILayoutx.DelayedPlaceholderField(new GUIContent("Asset Name".Localization()), item.assetName ?? string.Empty, new GUIContent(EditorAssetBundleSettings.AssetName)); using (new EditorGUI.DisabledGroupScope(string.IsNullOrEmpty(item.assetName))) { GUILayout.Label("Lower".Localization(), GUILayout.ExpandWidth(false)); if (string.IsNullOrEmpty(item.assetName)) { GUILayout.Toggle(EditorAssetBundleSettings.AssetNameToLower, GUIContent.none, GUILayout.ExpandWidth(false)); } else { item.assetNameToLower = GUILayout.Toggle(item.assetNameToLower, GUIContent.none, GUILayout.ExpandWidth(false)); } } } item.variants = new GUIContent("Variant".Localization() + $" ({item.variants.Count})").ArrayField(item.variants, (variantItem, variantIndex) => { variantItem.include = EditorGUILayout.DelayedTextField(new GUIContent("Include".Localization(), "Pattern"), variantItem.include ?? string.Empty); variantItem.exclude = EditorGUILayout.DelayedTextField(new GUIContent("Exclude".Localization(), "Pattern"), variantItem.exclude ?? string.Empty); variantItem.variant = EditorGUILayout.DelayedTextField("Variant".Localization(), variantItem.variant ?? string.Empty); return(variantItem); }, initExpand: false, itemStyle: "box") as List <AssetBundleGroup.BundleVariant>; using (var foldout = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(collectionInclude, new GUIContent("Include".Localization() + $" ({item.includeGuids.Count})"))) using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { if (foldout.Visiable) { using (new GUILayout.HorizontalScope()) { GUI.backgroundColor = collectionInclude ? Color.yellow : Color.white; if (GUILayout.Button(collectionInclude ? "Stop Collection".Localization() : "Start Collection".Localization())) { if (collectionInclude) { StopCollection(); } else { EditorAssetBundles.LoadAssetCallback += LoadAssetCallback; collectionInclude = asset; collectionExclude = null; //EditorApplication.isPlaying = true; } } GUI.backgroundColor = Color.white; if (GUILayout.Button("Clear".Localization())) { foreach (var item2 in asset.items) { item2.includeGuids.Clear(); } EditorUtility.SetDirty(asset); } } var array = item.includeGuids.Select(o => new string[] { o, AssetDatabase.GUIDToAssetPath(o) }).OrderBy(o => o[1]).ToArray(); for (int j = 0; j < array.Length; j++) { string guid = array[j][0]; assetPath = array[j][1]; using (new GUILayout.HorizontalScope()) { if (string.IsNullOrEmpty(assetPath)) { GUI.color = Color.red; GUILayout.Label(guid + " (missing)"); GUI.color = Color.white; } else { string assetName = BuildAssetBundles.GetAssetName(item, assetPath); if (GUILayout.Button(new GUIContent(assetName, assetPath), "label")) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object))); } } if (GUILayout.Button("X", GUILayout.ExpandWidth(false))) { item.includeGuids.Remove(guid); } } } } } using (var foldout = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(collectionExclude, new GUIContent("Exclude".Localization() + $" ({item.excludeGuids.Count})"))) using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { if (foldout.Visiable) { using (new GUILayout.HorizontalScope()) { GUI.backgroundColor = collectionExclude ? Color.yellow : Color.white; if (GUILayout.Button(collectionExclude ? "Stop Collection".Localization() : "Start Collection".Localization())) { if (collectionExclude) { StopCollection(); } else { EditorAssetBundles.LoadAssetCallback += LoadAssetCallback; collectionExclude = asset; collectionInclude = null; //EditorApplication.isPlaying = true; } } GUI.backgroundColor = Color.white; if (GUILayout.Button("Clear".Localization())) { foreach (var item2 in asset.items) { item2.excludeGuids.Clear(); } EditorUtility.SetDirty(asset); } } var array = item.excludeGuids.Select(o => new string[] { o, AssetDatabase.GUIDToAssetPath(o) }).OrderBy(o => o[1]).ToArray(); for (int j = 0; j < array.Length; j++) { string guid = array[j][0]; assetPath = array[j][1]; using (new GUILayout.HorizontalScope()) { if (string.IsNullOrEmpty(assetPath)) { GUI.color = Color.red; GUILayout.Label(guid + " (missing)"); GUI.color = Color.white; } else { string assetName = BuildAssetBundles.GetAssetName(item, assetPath); if (GUILayout.Button(new GUIContent(assetName, assetPath), "label")) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object))); } } if (GUILayout.Button("X", GUILayout.ExpandWidth(false))) { item.excludeGuids.Remove(guid); } } } } } using (var foldout = new EditorGUILayoutx.Scopes.FoldoutHeaderGroupScope(false, new GUIContent($"Preview".Localization()), onShow: () => { Load(item); })) using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { if (foldout.Visiable) { List <string[]> list; if (cachedAssets.TryGetValue(item, out list)) { int max = displayMax; var array = list; for (int j = 0; j < list.Count && j < max; j++) { string guid = array[j][0]; assetPath = array[j][1]; using (new GUILayout.HorizontalScope()) { if (string.IsNullOrEmpty(assetPath)) { GUI.color = Color.red; GUILayout.Label(guid + " (missing)"); GUI.color = Color.white; } else { string assetName = BuildAssetBundles.GetAssetName(item, assetPath); string bundleName, variant; bundleName = Asset.GetBundleName(assetPath, out variant); if (GUILayout.Button(new GUIContent(assetName + " [" + bundleName + (string.IsNullOrEmpty(variant) ? "" : " ." + variant) + "]", assetPath), "label")) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object))); } } } } if (list.Count > max) { GUILayout.Label("..."); } } } } } return(item); }, initExpand: true, itemStyle: "box"); if (checker.changed) { EditorUtility.SetDirty(asset); } } using (new GUILayout.HorizontalScope()) { if (GUILayout.Button("Clear Missing".Localization())) { ValidateAssets(); } //if (GUILayout.Button("Reset")) //{ // if (Asset.items.Sum(o => o.guids.Count) == 0 || EditorUtility.DisplayDialog("Confirm", "Delete all ?", "Yes", "No")) // { // Reload(); // } //} } } }