void DrawTypeNode(XmlElement typeNode) { XmlAttribute attr; string typeName; typeName = typeNode.GetAttributeValue("type", string.Empty); attr = typeNode.GetOrAddAttribute("name", string.Empty); Type type = null; if (!string.IsNullOrEmpty(typeName)) { type = FindType(typeName); } object obj = null; using (new EditorGUILayout.HorizontalScope()) { EditorGUILayoutx.MenuButton(new GUIContent(typeName), "label", () => { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Delete".Localization()), false, () => { using (EditorOneBuild.EditorLocalizationValues.BeginScope()) { if (EditorUtility.DisplayDialog("Delete".Localization(), string.Format("msg_del_type_content".Localization(), typeName), "ok", "cancel")) { typeNode.ParentNode.RemoveChild(typeNode); DirtyConfig(); } } }); return(menu); }); attr.Value = EditorGUILayoutx.DelayedPlaceholderField(attr.Value ?? string.Empty, new GUIContent("Alias".Localization()), GUILayout.Width(120)); EditorGUILayoutx.MenuButton(new GUIContent("+"), "label", () => { GenericMenu menu = new GenericMenu(); var members = new Dictionary <string, MemberInfo>(EditorOneBuild.GetSetMembers(type)); foreach (XmlNode itemNode in typeNode.SelectNodes("ns:*", nsMgr)) { if (itemNode.NodeType == XmlNodeType.Element) { members.Remove(itemNode.Name); } } foreach (var member in members.Values.OrderBy(o => o.Name)) { if (member.IsDefined(typeof(System.ObsoleteAttribute), true)) { continue; } MethodInfo method1 = member as MethodInfo; if (method1 != null) { if (member.Name.StartsWith("Get") && method1.ReturnType != typeof(void)) { continue; } } menu.AddItem(new GUIContent(member.Name), false, (data) => { MemberInfo mInfo = (MemberInfo)data; XmlNode memberNode = typeNode.OwnerDocument.CreateElement(mInfo.Name, EditorOneBuild.XMLNS); if (mInfo.MemberType == MemberTypes.Field || mInfo.MemberType == MemberTypes.Property) { Type valueType; if (mInfo.MemberType == MemberTypes.Field) { FieldInfo fInfo = (FieldInfo)mInfo; valueType = fInfo.FieldType; } else { PropertyInfo pInfo = (PropertyInfo)mInfo; valueType = pInfo.PropertyType; } memberNode.InnerText = valueType.GetDefaultValue().ToStringOrEmpty(); } else if (mInfo.MemberType == MemberTypes.Method) { MethodInfo method = (MethodInfo)mInfo; foreach (var p in method.GetParameters()) { XmlNode paramNode = memberNode.OwnerDocument.CreateElement(p.Name, EditorOneBuild.XMLNS); paramNode.InnerText = p.ParameterType.GetDefaultValue().ToStringOrEmpty(); memberNode.AppendChild(paramNode); } } typeNode.AppendChild(memberNode); DirtyConfig(); }, member); } return(menu); }, GUILayout.ExpandWidth(false)); } if (string.IsNullOrEmpty(typeName)) { //EditorGUILayout.HelpBox("type name empty", MessageType.Error); // GUIUtility.ExitGUI(); } if (type == null) { //if (Event.current.type == EventType.Repaint) //EditorGUILayout.HelpBox($"type null, <{typeName}>", MessageType.Error); return; } using (new EditorGUILayoutx.Scopes.IndentLevelVerticalScope()) { foreach (var itemNode in ToEnumerable(typeNode.SelectNodes("*"))) { DrawConfigItem(type, itemNode); } } }
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(); // } //} } } }
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(); } } } }
void GUINewItem() { if (string.IsNullOrEmpty(baseData.path)) { return; } string error = null; using (new GUILayout.HorizontalScope()) { searchKey = EditorGUILayoutx.SearchTextField(searchKey, GUIContent.none, GUILayout.Width(EditorGUIUtility.labelWidth)); int typeNameIndex = 0; string[] typeNames = EditorLocalization.GetValueTypeNames().ToArray(); for (int i = 0; i < typeNames.Length; i++) { if (typeNames[i] == newValueTypeName) { typeNameIndex = i; break; } } float width = (Screen.width - EditorGUIUtility.labelWidth) * 0.3f; width = Mathf.Min(width, 150); typeNameIndex = EditorGUILayout.Popup(typeNameIndex, typeNames.Select(o => ("type_" + o).Localization()).ToArray(), GUILayout.Width(width)); newValueTypeName = typeNames[typeNameIndex]; string newKeyCurrent; newKey = EditorGUILayoutx.DelayedPlaceholderField(newKey ?? string.Empty, out newKeyCurrent, new GUIContent("New Key".Localization()) /*, GUILayout.Width(EditorGUIUtility.labelWidth)*/); if (!string.IsNullOrEmpty(newKeyCurrent)) { if (baseData.values.ContainsKey(newKeyCurrent)) { error = string.Format("key <{0}> base exists", newKeyCurrent); } } if (!string.IsNullOrEmpty(newKey) && error == null) { var value = new LocalizationValue(newValueTypeName, Localization.GetValueProvider(newValueTypeName).DefaultValue); if (newValueTypeName == "string") { value.Value = newKey; } baseData.values[newKey] = value; newKey = string.Empty; GUIUtility.keyboardControl = -1; DiryBaseData(); } } if (error != null) { EditorGUILayout.HelpBox(error, MessageType.Error); } }