private void DrawSettingsGUI() { var labelWidth = 80f; EditorLayoutTools.DrawLabelWithBackground("Settings", EditorLayoutTools.BackgroundColor, EditorLayoutTools.LabelColor); using (new EditorGUILayout.HorizontalScope()) { var labels = BlockSizes.Select(x => x.ToString()).ToArray(); GUILayout.Label("BlockSize", GUILayout.Width(labelWidth)); blockSize = EditorGUILayout.IntPopup(blockSize, labels, BlockSizes, GUILayout.Width(75f)); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("Padding", GUILayout.Width(labelWidth)); padding = Mathf.Clamp(EditorGUILayout.IntField(padding, GUILayout.Width(75f)), 1, 5); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("AlphaMap", GUILayout.Width(labelWidth)); hasAlphaMap = EditorGUILayout.Toggle(hasAlphaMap, GUILayout.Width(75f)); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("FilterMode", GUILayout.Width(labelWidth)); filterMode = (FilterMode)EditorGUILayout.EnumPopup(filterMode, GUILayout.Width(75f)); } }
protected override void DrawContent(int index, FindDependencyAssetsWindow.AssetBundleInfo content) { content.IsOpen = EditorLayoutTools.DrawHeader(content.AssetBundleName, content.IsOpen); if (content.IsOpen) { using (new ContentsScope()) { if (content.Assets.Any()) { foreach (var asset in content.Assets) { using (new EditorGUILayout.HorizontalScope()) { EditorLayoutTools.DrawLabelWithBackground("Asset", new Color(0.9f, 0.4f, 0.4f, 0.3f), null, TextAnchor.MiddleCenter, 90f); EditorGUILayout.ObjectField("", asset, typeof(Object), false, GUILayout.Width(250f)); } } } if (content.DependentAssets.Any()) { foreach (var dependentAsset in content.DependentAssets) { using (new EditorGUILayout.HorizontalScope()) { EditorLayoutTools.DrawLabelWithBackground("Dependent", new Color(0.4f, 0.4f, 0.9f, 0.5f), null, TextAnchor.MiddleCenter, 90f); EditorGUILayout.ObjectField("", dependentAsset, typeof(Object), false, GUILayout.Width(250f)); } } } } } }
private void DrawAtlasInfos() { EditorLayoutTools.DrawLabelWithBackground("Input", EditorLayoutTools.BackgroundColor, EditorLayoutTools.LabelColor); var tex = selectAtlas.Texture; var labelWidth = 80f; using (new EditorGUILayout.HorizontalScope()) { if (tex != null) { if (GUILayout.Button("Texture", GUILayout.Width(labelWidth))) { Selection.activeObject = tex; } GUILayout.Label(" " + tex.width + "x" + tex.height); } else { GUI.color = Color.grey; GUILayout.Button("Texture", GUILayout.Width(labelWidth)); GUI.color = Color.white; GUILayout.Label(" N/A"); } } }
private void DrawContentGUI(string label, string content) { EditorLayoutTools.DrawLabelWithBackground(label, new Color(0.3f, 0.3f, 0.5f), new Color(0.8f, 0.8f, 0.8f, 0.8f)); using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUILayout.VerticalScope()) { if (GUILayout.Button("copy", GUILayout.Width(45f), GUILayout.Height(18f))) { UniClipboard.SetText(content); } GUILayout.Space(2f); } var textStyle = new GUIStyle(); var textSize = textStyle.CalcSize(new GUIContent(content)); var originLabelWidth = EditorLayoutTools.SetLabelWidth(textSize.x); GUILayout.Label(content, GUILayout.Height(20f)); EditorLayoutTools.SetLabelWidth(originLabelWidth); GUILayout.FlexibleSpace(); } }
protected override void DrawContent(int index, Content content) { if (tabNextIconContent == null) { tabNextIconContent = EditorGUIUtility.IconContent("tab_next"); } using (new EditorGUILayout.HorizontalScope()) { var type = content.isAssetBundle ? "AssetBundle" : "Other Assets"; var color = content.isAssetBundle ? new Color(0.3f, 0.3f, 1f) : new Color(0.3f, 1f, 0.3f); var originLabelWidth = EditorLayoutTools.SetLabelWidth(75f); EditorLayoutTools.DrawLabelWithBackground(type, color, width: 70f, options: GUILayout.Height(15f)); EditorLayoutTools.SetLabelWidth(content.label); EditorGUILayout.SelectableLabel(content.label, GUILayout.Height(18f)); EditorLayoutTools.SetLabelWidth(originLabelWidth); GUILayout.FlexibleSpace(); if (GUILayout.Button(tabNextIconContent, EditorStyles.label, GUILayout.Width(20f), GUILayout.Height(20f))) { if (onRequestDetailView != null) { onRequestDetailView.OnNext(content.label); } } } }
protected override void DrawContent(int index, FindDependencyAssetsWindow.AssetReferenceInfo content) { var count = content.ReferenceAssets.Length; if (count < 2) { return; } using (new EditorGUILayout.HorizontalScope()) { EditorLayoutTools.DrawLabelWithBackground(count.ToString(), new Color(1f, 0.65f, 0f, 0.5f), null, TextAnchor.MiddleCenter, 30f); EditorGUILayout.ObjectField("", content.Asset, typeof(Object), false, GUILayout.Width(250f)); } }
void OnGUI() { EditorGUILayout.Separator(); var backgroundColor = new Color(0.8f, 1.0f, 0.3f); var labelColor = new Color(0.8f, 0.8f, 0.8f, 0.8f); EditorLayoutTools.DrawLabelWithBackground("Import from AtomCraft folder", backgroundColor, labelColor); if (GUILayout.Button("Import")) { CriAssetUpdater.Execute(); } EditorGUILayout.Separator(); }
public void Draw() { IsOpen = EditorLayoutTools.DrawHeader(manageAssetPath, IsOpen); if (IsOpen) { using (new ContentsScope()) { EditorGUI.BeginDisabledGroup(!IsEdit); { var layoutWidth = 350f; using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5f); using (new EditorGUILayout.VerticalScope()) { GUILayout.Space(5f); // このフィールドは編集不可. EditorGUI.BeginDisabledGroup(true); { EditorGUILayout.ObjectField(string.Empty, manageInfo.assetObject, typeof(Object), false, GUILayout.Width(350f)); } EditorGUI.EndDisabledGroup(); } GUILayout.FlexibleSpace(); if (!IsEdit) { // Editボタンだけ常にアクティブ化させる. EditorGUI.EndDisabledGroup(); { if (GUILayout.Button("Edit", GUILayout.Width(60f))) { IsEdit = true; } } EditorGUI.BeginDisabledGroup(!IsEdit); } else { if (GUILayout.Button("Delete", GUILayout.Width(60f))) { if (EditorUtility.DisplayDialog("確認", "命名規則を削除します", "続行", "中止")) { if (onDeleteManageInfo != null) { onDeleteManageInfo.OnNext(Unit.Default); } return; } } // 必要なパラメータが足りない時はApplyさせない. var apply = true; switch (manageInfo.assetBundleNameType) { case ManageInfo.NameType.Specified: case ManageInfo.NameType.PrefixAndChildAssetName: if (string.IsNullOrEmpty(manageInfo.assetBundleNameStr)) { apply = false; } break; } EditorGUI.BeginDisabledGroup(!apply); { if (GUILayout.Button("Apply")) { IsEdit = false; if (onUpdateManageInfo != null) { onUpdateManageInfo.OnNext(Unit.Default); } } } EditorGUI.EndDisabledGroup(); } GUILayout.Space(5f); } GUILayout.Space(2f); var originLabelWidth = EditorLayoutTools.SetLabelWidth(80f); if (!ignoreType.HasValue || ignoreType != IgnoreType.IgnoreAssetBundle) { EditorGUI.BeginChangeCheck(); var isAssetBundle = EditorGUILayout.Toggle("AssetBundle", manageInfo.isAssetBundle, GUILayout.Width(100f)); if (EditorGUI.EndChangeCheck()) { manageInfo.isAssetBundle = isAssetBundle; } } GUILayout.Space(2f); if (manageInfo.isAssetBundle) { EditorGUI.BeginChangeCheck(); var assetBundleNameType = manageInfo.assetBundleNameType; assetBundleNameType = (ManageInfo.NameType)EditorGUILayout.EnumPopup("Type", assetBundleNameType, GUILayout.Width(layoutWidth)); if (EditorGUI.EndChangeCheck()) { manageInfo.assetBundleNameType = assetBundleNameType; manageInfo.assetBundleNameStr = null; } GUILayout.Space(2f); var assetBundleNameStr = manageInfo.assetBundleNameStr; switch (manageInfo.assetBundleNameType) { case ManageInfo.NameType.Specified: assetBundleNameStr = EditorGUILayout.DelayedTextField("Specified", assetBundleNameStr, GUILayout.Width(layoutWidth)); manageInfo.assetBundleNameStr = assetBundleNameStr != null?assetBundleNameStr.ToLower() : string.Empty; break; case ManageInfo.NameType.PrefixAndChildAssetName: assetBundleNameStr = EditorGUILayout.DelayedTextField("Prefix", assetBundleNameStr, GUILayout.Width(layoutWidth)); manageInfo.assetBundleNameStr = assetBundleNameStr != null?assetBundleNameStr.ToLower() : string.Empty; break; } } manageInfo.comment = EditorGUILayout.DelayedTextField("Memo", manageInfo.comment, GUILayout.Width(layoutWidth), GUILayout.Height(38f)); EditorLayoutTools.SetLabelWidth(originLabelWidth); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); EditorLayoutTools.DrawLabelWithBackground("Contents", new Color(0.7f, 0.9f, 0.7f)); using (new ContentsScope()) { var options = scrollEnable ? new GUILayoutOption[] { GUILayout.Height(250) } : new GUILayoutOption[0]; contentsScrollView.Draw(scrollEnable, options); } } } }
public void Draw() { EditorLayoutTools.DrawLabelWithBackground(title, color); }
public override void DrawInspectorGUI(UnityEngine.Object target) { if (cueInfos == null) { return; } GUILayout.Space(4f); var acbPath = AssetDatabase.GetAssetPath(target); EditorLayoutTools.DrawLabelWithBackground("Asset Path"); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.SelectableLabel(acbPath, EditorStyles.textArea, GUILayout.Height(18f)); if (GUILayout.Button(clipboardIcon, GUILayout.Width(20f))) { GUIUtility.systemCopyBuffer = acbPath; } } GUILayout.Space(4f); if (cueInfos.IsEmpty()) { EditorGUILayout.HelpBox("CueSheet dont have Cue.", MessageType.Info); } else { EditorLayoutTools.DrawLabelWithBackground("Contents"); using (new ContentsScope()) { using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition, GUILayout.MaxHeight(500f))) { foreach (var cueInfo in cueInfos) { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(cueInfo.Cue, EditorStyles.textArea, GUILayout.Height(18f)); if (GUILayout.Button(clipboardIcon, GUILayout.Width(20f))) { GUIUtility.systemCopyBuffer = cueInfo.Cue; } } if (!string.IsNullOrEmpty(cueInfo.Summary)) { EditorGUILayout.LabelField(cueInfo.Summary, EditorStyles.textArea, GUILayout.Height(18f)); } GUILayout.Space(3f); } scrollPosition = scrollViewScope.scrollPosition; } } } EditorGUILayout.Separator(); }
private void CustomInspector() { var managedFolders = instance.ManagedFolders.ToList(); var contentHeight = 16f; EditorLayoutTools.SetLabelWidth(100f); // Style. var pathTextStyle = GUI.skin.GetStyle("TextArea"); pathTextStyle.alignment = TextAnchor.MiddleLeft; EditorGUILayout.Separator(); // InitialScene. using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("Initial Scene", GUILayout.Width(80f), GUILayout.Height(contentHeight)); GUILayout.Label(instance.InitialScene, pathTextStyle, GUILayout.Height(contentHeight)); if (GUILayout.Button("Select", GUILayout.Width(60f), GUILayout.Height(contentHeight))) { UnityEditorUtility.RegisterUndo("SceneImporterConfigInspector-Undo", instance); var initialScenePath = EditorUtility.OpenFilePanelWithFilters("Select Initial Scene", "Assets", new string[] { "SceneFile", "unity" }); initialScenePath = initialScenePath.Replace(Application.dataPath, "Assets"); Reflection.SetPrivateField(instance, "initialScene", initialScenePath); } } EditorGUILayout.Separator(); // AutoAdditionFolders. EditorLayoutTools.DrawLabelWithBackground("Managed Folders"); var change = false; using (new ContentsScope()) { var scrollViewHeight = System.Math.Min(contentHeight * managedFolders.Count + 5f, 300f); using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition, GUILayout.Height(scrollViewHeight))) { for (var i = 0; i < managedFolders.Count; ++i) { var folder = managedFolders[i]; using (new EditorGUILayout.HorizontalScope()) { var label = string.IsNullOrEmpty(folder) ? folder : folder + "/"; GUILayout.Label(label, pathTextStyle, GUILayout.Height(contentHeight)); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(24f), GUILayout.Height(contentHeight))) { managedFolders.RemoveAt(i); change = true; } } } scrollPosition = scrollViewScope.scrollPosition; } using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(40f))) { var folderPath = EditorUtility.OpenFolderPanel("Select Auto Addition Scene Folder", "Assets", ""); if (folderPath.Contains(Application.dataPath)) { folderPath = folderPath.Replace(Application.dataPath, "Assets"); if (folderPath != "Assets" && !managedFolders.Contains(folderPath)) { managedFolders.Add(folderPath); change = true; } } } } if (change) { Reflection.SetPrivateField(instance, "managedFolders", managedFolders.OrderBy(x => x).ToList()); UnityEditorUtility.RegisterUndo("SceneImporterSettingsObject Undo", instance); } } }
protected override void DrawContent(int index, AssetInfo content) { if (textAreaStyle == null) { textAreaStyle = GUI.skin.GetStyle("TextArea"); textAreaStyle.alignment = TextAnchor.MiddleLeft; textAreaStyle.wordWrap = false; textAreaStyle.stretchWidth = true; } var opened = openedIds.Contains(index); using (new EditorGUILayout.VerticalScope()) { var open = EditorLayoutTools.DrawHeader(content.AssetPath, opened); if (open) { using (new ContentsScope()) { var targetAsset = AssetDatabase.LoadMainAssetAtPath(content.AssetPath); EditorGUILayout.ObjectField(targetAsset, typeof(Object), false); EditorLayoutTools.DrawLabelWithBackground("InvalidDependants", Color.red, Color.white); using (new ContentsScope()) { foreach (var item in content.InvalidDependants) { using (new EditorGUILayout.HorizontalScope()) { switch (AssetViewMode) { case AssetViewMode.Asset: { var asset = AssetDatabase.LoadMainAssetAtPath(item); EditorGUILayout.ObjectField(asset, typeof(Object), false); } break; case AssetViewMode.Path: { EditorGUILayout.SelectableLabel(item, textAreaStyle, GUILayout.Height(18f)); } break; } } } } } } if (!opened && open) { openedIds.Add(index); } if (opened && !open) { openedIds.Remove(index); } } }
private void DrawContents() { var labelBackgroundColor = new Color(0.2f, 0.8f, 0.5f, 0.8f); EditorLayoutTools.DrawLabelWithBackground("ShaderVariantCollection", labelBackgroundColor, EditorLayoutTools.LabelColor); EditorGUI.BeginChangeCheck(); shaderVariantCollection = EditorLayoutTools.ObjectField(shaderVariantCollection, false); if (EditorGUI.EndChangeCheck()) { targetFolder = null; shaderInfos.Clear(); scrollPosition = Vector2.zero; } GUILayout.Space(2f); EditorLayoutTools.DrawLabelWithBackground("TargetFolder", labelBackgroundColor, EditorLayoutTools.LabelColor); EditorGUI.BeginChangeCheck(); targetFolder = EditorLayoutTools.ObjectField(targetFolder, false); if (EditorGUI.EndChangeCheck()) { if (!UnityEditorUtility.IsFolder(targetFolder)) { targetFolder = null; } shaderInfos.Clear(); scrollPosition = Vector2.zero; } GUILayout.Space(2f); if (shaderVariantCollection != null) { if (shaderInfos.IsEmpty()) { EditorGUILayout.HelpBox("Please search shader.", MessageType.Info); } else { using (new EditorGUILayout.HorizontalScope()) { EditorLayoutTools.DrawLabelWithBackground("Shaders", labelBackgroundColor, EditorLayoutTools.LabelColor); assetViewMode = (AssetViewMode)EditorGUILayout.EnumPopup(assetViewMode, GUILayout.Width(60f)); } using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("add all", GUILayout.Width(120f))) { shaderInfos.ForEach(x => x.add = true); } if (GUILayout.Button("remove all", GUILayout.Width(120f))) { shaderInfos.ForEach(x => x.add = false); } GUILayout.FlexibleSpace(); } using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition)) { using (new ContentsScope()) { foreach (var shaderInfo in shaderInfos) { using (new EditorGUILayout.HorizontalScope()) { shaderInfo.add = EditorGUILayout.Toggle(shaderInfo.add, GUILayout.Width(20f)); switch (assetViewMode) { case AssetViewMode.Asset: EditorLayoutTools.ObjectField(shaderInfo.shader, false, GUILayout.Height(15f)); break; case AssetViewMode.Path: EditorGUILayout.SelectableLabel(shaderInfo.assetPath, GUILayout.Height(15f)); break; } } GUILayout.Space(2f); } } scrollPosition = scrollViewScope.scrollPosition; } } GUILayout.Space(2f); GUILayout.FlexibleSpace(); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Search", GUILayout.Width(150f))) { BuildShaderInfos(); } GUILayout.Space(20f); using (new DisableScope(shaderInfos.IsEmpty())) { if (GUILayout.Button("Update", GUILayout.Width(150f))) { ApplyShaderVariantCollection(); } } GUILayout.FlexibleSpace(); } } else { EditorGUILayout.HelpBox("Select shaderVariant file.", MessageType.Info); } }
void OnGUI() { var requireBuild = false; if (!initialized) { return; } if (!isloaded) { LoadContents(); return; } GUILayout.Space(5f); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5f); using (new EditorGUILayout.VerticalScope()) { // 環境毎のビルド設定. EditorLayoutTools.DrawLabelWithBackground("Parameter", BackgroundColor, LabelColor); { EditorGUILayout.Separator(); DrawCustomParameterSelect(); EditorGUILayout.Separator(); } EditorGUILayout.Separator(); // ビルドオプション. EditorLayoutTools.DrawLabelWithBackground("Build Options", BackgroundColor, LabelColor); { EditorGUILayout.Separator(); DrawBuildOptions(); EditorGUILayout.Separator(); } GUILayout.FlexibleSpace(); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(20f); // 適用. if (GUILayout.Button("Apply")) { GUI.FocusControl(string.Empty); if (EditorUtility.DisplayDialog("Confirmation", "選択中の設定でビルド設定を更新します", "実行", "中止")) { var buildTarget = selectionBuildParam.buildTarget; var buildParam = selectionBuildParam.buildParam; BuildManager.Apply(buildTarget, buildParam); Repaint(); return; } } GUILayout.Space(20f); // ビルド. if (GUILayout.Button("Build")) { GUI.FocusControl(string.Empty); if (EditorUtility.DisplayDialog("Confirmation", "選択中の設定でビルドを実行します", "実行", "中止")) { requireBuild = true; } } GUILayout.Space(20f); } EditorGUILayout.Separator(); } GUILayout.Space(5f); } GUILayout.Space(5f); // スコープの途中でアセンブリのリロードが実行されるとエラーが出るためここでビルドを開始. if (requireBuild) { Close(); EditorApplication.delayCall += Build; } }
void OnGUI() { GUILayout.Space(5f); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5f); using (new EditorGUILayout.VerticalScope()) { GUILayout.Space(5f); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); assetViewMode = (AssetViewMode)EditorGUILayout.EnumPopup(assetViewMode, GUILayout.Width(60f)); GUILayout.Space(5f); string before = searchText; string after = EditorGUILayout.TextField(string.Empty, before, "SearchTextField", GUILayout.Width(200f)); if (before != after) { searchText = after; scrollPosition = Vector2.zero; } if (GUILayout.Button(string.Empty, "SearchCancelButton", GUILayout.Width(18f))) { searchText = string.Empty; GUIUtility.keyboardControl = 0; scrollPosition = Vector2.zero; } } GUILayout.Space(5f); var list = GetMatchOfList(); if (list.Any()) { using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition)) { foreach (var item in list) { using (new EditorGUILayout.HorizontalScope()) { var asset = assetObjectByAssetPath.GetValueOrDefault(item.assetPath); if (asset != null) { EditorGUILayout.LabelField(item.GetSizeText(), GUILayout.Width(70f)); EditorGUILayout.LabelField(string.Format("{0}%", item.ratio), GUILayout.Width(50f)); switch (assetViewMode) { case AssetViewMode.Asset: EditorGUILayout.ObjectField(asset, typeof(Object), false, GUILayout.MinWidth(250f)); break; case AssetViewMode.Path: EditorGUILayout.DelayedTextField(item.assetPath, GUILayout.MinWidth(250f)); break; } var isInvalidAsset = !buildInAssetTargetPaths.Any(x => item.assetPath.StartsWith(x)) || // 指定ディレクトリ以外のディレクトリに存在. ignoreBuildInAssetTargetPaths.Any(x => item.assetPath.StartsWith(x)) || // 含まれてはいけないディレクトリに存在. ignoreBuildInFolderNames.Any(x => item.assetPath.Split('/').Contains(x)); // 含まれていけないフォルダ名が含まれているか. // 指定されたAsset置き場にない or 同梱しないAsset置き場のAssetが混入. if (isInvalidAsset) { EditorLayoutTools.DrawLabelWithBackground("InvalidAsset", Color.red, Color.gray, width: 85f); } // ファイルサイズが指定された値を超えている. if (warningAssetSize <= item.size) { EditorLayoutTools.DrawLabelWithBackground("LargeAsset", Color.yellow, Color.gray, width: 80f); } GUILayout.Space(5f); } } } scrollPosition = scrollViewScope.scrollPosition; } } else { EditorGUILayout.HelpBox("Asset Not Found.", MessageType.Info); } GUILayout.Space(5f); } GUILayout.Space(5f); } }
//----- property ----- //----- method ----- public override void OnInspectorGUI() { instance = target as FontKerningSetting; var updated = false; var deleteIndexs = new List <int>(); var infos = Reflection.GetPrivateField <FontKerningSetting, FontKerningSetting.CharInfo[]>(instance, "infos"); var description = Reflection.GetPrivateField <FontKerningSetting, byte[]>(instance, "description"); var list = infos != null?infos.ToList() : new List <FontKerningSetting.CharInfo>(); if (applyTargets == null) { applyTargets = UnityUtility.FindObjectsOfType <TextSpacing>().ToArray(); } //------ Font ------ EditorGUILayout.Separator(); EditorLayoutTools.DrawLabelWithBackground("Font", HeaderColor); GUILayout.Space(2f); EditorGUI.BeginChangeCheck(); var font = EditorGUILayout.ObjectField(instance.Font, typeof(Font), false); if (EditorGUI.EndChangeCheck()) { list.Clear(); updated = true; } GUILayout.Space(2f); //------ Characters ------ if (font != null) { if (list.IsEmpty()) { EditorGUILayout.HelpBox("Press the + button if add info", MessageType.Info); } else { EditorLayoutTools.DrawLabelWithBackground("Character settings", HeaderColor); GUILayout.Space(2f); DrawCharInfoHeaderGUI(list.Count); using (new ContentsScope()) { using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(charInfoScrollPosition, GUILayout.Height(350f))) { for (var i = 0; i < list.Count; i++) { EditorGUI.BeginChangeCheck(); var delete = DrawCharInfoGUI(list[i]); GUILayout.Space(2f); if (EditorGUI.EndChangeCheck()) { var exist = list.Where(x => x.character != default(char)) .Where(x => x != list[i]) .Any(x => x.character == list[i].character); if (exist) { var title = "Register failed"; var message = string.Format("Char : {0} is already exists.", list[i].character); EditorUtility.DisplayDialog(title, message, "Close"); list[i].character = default(char); } updated = true; } if (delete) { deleteIndexs.Add(i); } } charInfoScrollPosition = scrollViewScope.scrollPosition; } } foreach (var index in deleteIndexs) { list.RemoveAt(index); } } using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(60f))) { var info = new FontKerningSetting.CharInfo(); list.Add(info); updated = true; } } } if (updated) { UnityEditorUtility.RegisterUndo("FontKerningSettingInspector Undo", instance); Reflection.SetPrivateField(instance, "font", font); Reflection.SetPrivateField(instance, "infos", list.Where(x => x != null).ToArray()); Reflection.SetPrivateField(instance, "dictionary", (Dictionary <char, FontKerningSetting.CharInfo>)null); ApplyTextSpacing(); } GUILayout.Space(2f); //------ Description ------ EditorLayoutTools.DrawLabelWithBackground("Description", HeaderColor); var textBytes = description.Decrypt(aesManaged); var descriptionText = textBytes != null?Encoding.UTF8.GetString(textBytes) : string.Empty; using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(descriptionScrollPosition, GUILayout.Height(60f))) { EditorGUI.BeginChangeCheck(); descriptionText = EditorGUILayout.TextArea(descriptionText, GUILayout.MinHeight(40f)); if (EditorGUI.EndChangeCheck()) { textBytes = Encoding.UTF8.GetBytes(descriptionText).Encrypt(aesManaged); Reflection.SetPrivateField(instance, "description", textBytes); } descriptionScrollPosition = scrollViewScope.scrollPosition; } }
void OnGUI() { var e = Event.current; if (textAreaStyle == null) { textAreaStyle = GUI.skin.GetStyle("TextArea"); textAreaStyle.alignment = TextAnchor.MiddleLeft; textAreaStyle.wordWrap = false; textAreaStyle.stretchWidth = true; } GUILayout.Space(3f); if (current != null) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); assetViewMode = (AssetViewMode)EditorGUILayout.EnumPopup(assetViewMode, GUILayout.Width(60f)); GUILayout.Space(5f); EditorGUI.BeginChangeCheck(); searchText = EditorGUILayout.TextField(string.Empty, searchText, "SearchTextField", GUILayout.Width(200f)); if (EditorGUI.EndChangeCheck()) { dependencies = GetDependencies(current); scrollPosition = Vector2.zero; } if (GUILayout.Button(string.Empty, "SearchCancelButton", GUILayout.Width(18f))) { searchText = string.Empty; GUIUtility.keyboardControl = 0; dependencies = GetDependencies(current); scrollPosition = Vector2.zero; } } GUILayout.Space(3f); var targetAsset = AssetDatabase.LoadMainAssetAtPath(current.AssetPath); EditorGUILayout.ObjectField(targetAsset, typeof(Object), false); GUILayout.Space(3f); if (dependencies.Any()) { EditorLayoutTools.DrawLabelWithBackground("Dependencies"); GUILayout.Space(-2f); using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition)) { using (new ContentsScope()) { foreach (var assetPath in dependencies) { switch (assetViewMode) { case AssetViewMode.Asset: { var asset = AssetDatabase.LoadMainAssetAtPath(assetPath); EditorGUILayout.ObjectField(asset, typeof(Object), false); } break; case AssetViewMode.Path: { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.SelectableLabel(assetPath, textAreaStyle, GUILayout.Height(16f)); if (GUILayout.Button("select", EditorStyles.miniButton, GUILayout.Width(50f), GUILayout.Height(16f))) { var asset = AssetDatabase.LoadMainAssetAtPath(assetPath); Selection.activeObject = asset; } } } break; } GUILayout.Space(1f); } scrollPosition = scrollViewScope.scrollPosition; } } } else { EditorGUILayout.HelpBox("This object has no dependencies.", MessageType.Warning); } } else { EditorGUILayout.HelpBox("Drag and drop asset.", MessageType.Info); } // ドロップエリア. switch (Event.current.type) { case EventType.DragUpdated: case EventType.DragPerform: var validate = ValidateDragAndDrop(DragAndDrop.objectReferences); DragAndDrop.visualMode = validate ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected; if (e.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); DragAndDrop.activeControlID = 0; if (validate) { Set(DragAndDrop.objectReferences.FirstOrDefault()); } } break; } }
//----- property ----- //----- method ----- public override void OnInspectorGUI() { instance = target as MessagePackConfig; serializedObject.Update(); var winCompilerRelativePath = serializedObject.FindProperty("winCompilerRelativePath"); var osxCompilerRelativePath = serializedObject.FindProperty("osxCompilerRelativePath"); var scriptExportAssetDir = serializedObject.FindProperty("scriptExportAssetDir"); var scriptName = serializedObject.FindProperty("scriptName"); // Style. var pathTextStyle = GUI.skin.GetStyle("TextArea"); pathTextStyle.alignment = TextAnchor.MiddleLeft; GUILayout.Label("MessagePack compiler (Win)"); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label(winCompilerRelativePath.stringValue, pathTextStyle); if (GUILayout.Button("Edit", GUILayout.Width(45f))) { UnityEditorUtility.RegisterUndo("MessagePackConfigInspector Undo", instance); var path = EditorUtility.OpenFilePanel("Select MessagePack compiler", Application.dataPath, "exe"); winCompilerRelativePath.stringValue = UnityPathUtility.MakeRelativePath(path); serializedObject.ApplyModifiedProperties(); } } GUILayout.Label("MessagePack compiler (OSX)"); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label(osxCompilerRelativePath.stringValue, pathTextStyle); if (GUILayout.Button("Edit", GUILayout.Width(45f))) { UnityEditorUtility.RegisterUndo("MessagePackConfigInspector Undo", instance); var path = EditorUtility.OpenFilePanel("Select MessagePack compiler", Application.dataPath, ""); osxCompilerRelativePath.stringValue = UnityPathUtility.MakeRelativePath(path); serializedObject.ApplyModifiedProperties(); } } GUILayout.Label("MessagePack Script Export"); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label(scriptExportAssetDir.stringValue, pathTextStyle); if (GUILayout.Button("Edit", GUILayout.Width(45f))) { UnityEditorUtility.RegisterUndo("MessagePackConfigInspector Undo", instance); var path = EditorUtility.OpenFolderPanel("Select Export Folder", Application.dataPath, string.Empty); scriptExportAssetDir.stringValue = UnityPathUtility.MakeRelativePath(path); serializedObject.ApplyModifiedProperties(); } } EditorGUI.BeginChangeCheck(); GUILayout.Label("Export FileName"); scriptName.stringValue = EditorGUILayout.DelayedTextField(scriptName.stringValue); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("MessagePackConfigInspector Undo", instance); serializedObject.ApplyModifiedProperties(); } GUILayout.Space(25f); //------ Private settings ------ #if UNITY_EDITOR_OSX EditorLayoutTools.DrawLabelWithBackground("Private settings", new Color(1f, 1f, 0f, 1f)); using (new ContentsScope()) { EditorGUI.BeginChangeCheck(); GUILayout.Label("MsBuild Path"); MessagePackConfig.Prefs.msbuildPath = EditorGUILayout.DelayedTextField(MessagePackConfig.Prefs.msbuildPath); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("MessagePackConfigInspector Undo", instance); } } #endif }
private AtlasAction DrawSpriteList(SpriteInfo[] spriteInfos) { var action = AtlasAction.None; if (spriteInfos.Any()) { EditorLayoutTools.DrawLabelWithBackground("Sprites", EditorLayoutTools.BackgroundColor, EditorLayoutTools.LabelColor); EditorGUILayout.Separator(); using (new EditorGUILayout.VerticalScope()) { using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPos)) { var delete = false; int index = 0; foreach (var spriteInfo in spriteInfos) { ++index; GUILayout.Space(-1f); var highlight = (AtlasTextureInspector.instance != null) && (EditorAtlasPrefs.selectedSprite == spriteInfo.name); GUI.backgroundColor = highlight ? Color.white : new Color(0.8f, 0.8f, 0.8f); using (new EditorGUILayout.HorizontalScope(EditorLayoutTools.TextAreaStyle, GUILayout.MinHeight(20f))) { GUI.backgroundColor = Color.white; GUILayout.Label(index.ToString(), GUILayout.Width(24f)); if (GUILayout.Button(spriteInfo.name, EditorStyles.label, GUILayout.Height(20f))) { selection = spriteInfo.name; } if (spriteInfo.action == SpriteAction.Add) { GUI.color = Color.green; GUILayout.Label("Add", GUILayout.Width(27f)); GUI.color = defaultColor; } else if (spriteInfo.action == SpriteAction.Update) { GUI.color = Color.cyan; GUILayout.Label("Update", GUILayout.Width(45f)); GUI.color = defaultColor; } else { if (deleteNames.Contains(spriteInfo.name)) { GUI.backgroundColor = Color.red; if (GUILayout.Button("Delete", GUILayout.Width(60f))) { delete = true; } GUI.backgroundColor = Color.green; if (GUILayout.Button("X", GUILayout.Width(22f))) { deleteNames.Remove(spriteInfo.name); delete = false; } } else { if (GUILayout.Button("X", GUILayout.Width(22f))) { if (!deleteNames.Contains(spriteInfo.name)) { deleteNames.Add(spriteInfo.name); } } } } GUILayout.Space(5f); if (delete) { action |= AtlasAction.Delete; } } } scrollPos = scrollViewScope.scrollPosition; } } } if (EditorAtlasPrefs.atlas != null && !string.IsNullOrEmpty(selection)) { AtlasTextureInspector.SelectSprite(selection); selection = null; } return(action); }
//----- property ----- //----- method ----- public override void OnInspectorGUI() { instance = target as ButtonReactiveText; DrawDefaultInspector(); EditorGUI.BeginChangeCheck(); var useShadow = Reflection.GetPrivateField <ButtonReactiveText, bool>(instance, "useShadow"); useShadow = EditorGUILayout.Toggle("Shadow", useShadow); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "useShadow", useShadow); } EditorGUI.BeginChangeCheck(); var useOutline = Reflection.GetPrivateField <ButtonReactiveText, bool>(instance, "useOutline"); useOutline = EditorGUILayout.Toggle("Outline", useOutline); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "useOutline", useOutline); } var backgroundColor = new Color(0.3f, 0.3f, 0.3f, 0.3f); var labelColor = new Color(0.8f, 0.8f, 0.8f, 0.8f); var originLabelWidth = EditorLayoutTools.SetLabelWidth(60f); EditorLayoutTools.DrawLabelWithBackground("Text", backgroundColor, labelColor); using (new EditorGUILayout.HorizontalScope()) { // enableColor. EditorGUI.BeginChangeCheck(); var enableColor = Reflection.GetPrivateField <ButtonReactiveText, Color>(instance, "enableColor"); enableColor = EditorGUILayout.ColorField("Enable", enableColor); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "enableColor", enableColor); } // disableColor. EditorGUI.BeginChangeCheck(); var disableColor = Reflection.GetPrivateField <ButtonReactiveText, Color>(instance, "disableColor"); disableColor = EditorGUILayout.ColorField("Disable", disableColor); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "disableColor", disableColor); } } if (useShadow) { EditorLayoutTools.DrawLabelWithBackground("Shadow", backgroundColor, labelColor); using (new EditorGUILayout.HorizontalScope()) { // enableColor. EditorGUI.BeginChangeCheck(); var enableShadowColor = Reflection.GetPrivateField <ButtonReactiveText, Color>(instance, "enableShadowColor"); enableShadowColor = EditorGUILayout.ColorField("Enable", enableShadowColor); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "enableShadowColor", enableShadowColor); } // disableColor. EditorGUI.BeginChangeCheck(); var disableShadowColor = Reflection.GetPrivateField <ButtonReactiveText, Color>(instance, "disableShadowColor"); disableShadowColor = EditorGUILayout.ColorField("Disable", disableShadowColor); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "disableShadowColor", disableShadowColor); } } } if (useOutline) { EditorLayoutTools.DrawLabelWithBackground("Outline", backgroundColor, labelColor); using (new EditorGUILayout.HorizontalScope()) { // enableColor. EditorGUI.BeginChangeCheck(); var enableOutlineColor = Reflection.GetPrivateField <ButtonReactiveText, Color>(instance, "enableOutlineColor"); enableOutlineColor = EditorGUILayout.ColorField("Enable", enableOutlineColor); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "enableOutlineColor", enableOutlineColor); } // disableColor. EditorGUI.BeginChangeCheck(); var disableOutlineColor = Reflection.GetPrivateField <ButtonReactiveText, Color>(instance, "disableOutlineColor"); disableOutlineColor = EditorGUILayout.ColorField("Disable", disableOutlineColor); if (EditorGUI.EndChangeCheck()) { UnityEditorUtility.RegisterUndo("ButtonReactiveTextInspector Undo", instance); Reflection.SetPrivateField(instance, "disableOutlineColor", disableOutlineColor); } } } EditorLayoutTools.SetLabelWidth(originLabelWidth); }
private void DrawUpdateGUI(DicingTexture dicingTexture) { var labelStyle = new GUIStyle(EditorStyles.label); var defaultColor = labelStyle.normal.textColor; var defaultBackgroundColor = GUI.backgroundColor; var delete = false; if (textureInfos.Any()) { EditorLayoutTools.DrawLabelWithBackground("Sprites", EditorLayoutTools.BackgroundColor, EditorLayoutTools.LabelColor); EditorGUILayout.Separator(); using (new EditorGUILayout.VerticalScope()) { using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition)) { int index = 0; for (var i = 0; i < textureInfos.Length; i++) { ++index; GUILayout.Space(-1f); var textureName = textureInfos[i].texture != null ? textureInfos[i].texture.name : null; var highlight = selectionTextureName == textureName; GUI.backgroundColor = highlight ? Color.white : new Color(0.8f, 0.8f, 0.8f); using (new EditorGUILayout.HorizontalScope(EditorLayoutTools.TextAreaStyle, GUILayout.MinHeight(20f))) { GUI.backgroundColor = Color.white; GUILayout.Label(index.ToString(), GUILayout.Width(24f)); if (GUILayout.Button(textureName, EditorStyles.label, GUILayout.Height(20f))) { selectionTextureName = textureName; } switch (textureInfos[i].status) { case TextureStatus.Add: labelStyle.normal.textColor = Color.green; GUILayout.Label("Add", labelStyle, GUILayout.Width(27f)); break; case TextureStatus.Update: labelStyle.normal.textColor = Color.cyan; GUILayout.Label("Update", labelStyle, GUILayout.Width(45f)); break; case TextureStatus.Missing: labelStyle.normal.textColor = Color.yellow; GUILayout.Label("Missing", labelStyle, GUILayout.Width(45f)); break; } labelStyle.normal.textColor = defaultColor; if (deleteNames.Contains(textureName)) { GUI.backgroundColor = Color.red; if (GUILayout.Button("Delete", GUILayout.Width(60f))) { delete = true; } GUI.backgroundColor = Color.green; if (GUILayout.Button("X", GUILayout.Width(22f))) { deleteNames.Remove(textureName); } } else { if (GUILayout.Button("X", GUILayout.Width(22f))) { if (!deleteNames.Contains(textureName)) { deleteNames.Add(textureName); } } } GUILayout.Space(5f); } } scrollPosition = scrollViewScope.scrollPosition; } } } if (calcPerformance) { GUILayout.Space(5f); EditorLayoutTools.DrawLabelWithBackground("Result", EditorLayoutTools.BackgroundColor, EditorLayoutTools.LabelColor); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("MemorySize", GUILayout.Width(75f)); var dicingMemSize = infoFileSize + totalAtlasMemSize; labelStyle.normal.textColor = totalMemSize < dicingMemSize ? Color.red : defaultColor; GUILayout.Label(string.Format("{0:F1} MB >>> {1:F1} MB : {2:F1}% ", totalMemSize, dicingMemSize, 100.0f * dicingMemSize / totalMemSize), labelStyle); labelStyle.normal.textColor = defaultColor; } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("FileSize", GUILayout.Width(75f)); var dicingFileSize = infoFileSize + atlasFileSize; labelStyle.normal.textColor = totalFileSize < atlasFileSize ? Color.red : defaultColor; GUILayout.Label(string.Format("{0:F1} MB >>> {1:F1} MB : {2:F1}% ", totalFileSize, dicingFileSize, 100.0f * dicingFileSize / totalFileSize), labelStyle); labelStyle.normal.textColor = defaultColor; } } GUILayout.Space(15f); using (new EditorGUILayout.HorizontalScope()) { GUI.backgroundColor = Color.cyan; GUILayout.FlexibleSpace(); if (GUILayout.Button("Apply", GUILayout.Width(150f))) { GenerateDicingTexture(dicingTexture); } GUI.backgroundColor = defaultBackgroundColor; GUILayout.Space(25f); if (GUILayout.Button("View Textures", GUILayout.Width(150f))) { Action <string> onSelection = x => { selectionTextureName = x; Repaint(); }; DicingSpriteSelector.Show(dicingTexture, selectionTextureName, onSelection, null); } GUILayout.FlexibleSpace(); } if (delete) { GenerateDicingTexture(dicingTexture); } GUILayout.Space(5f); }
void OnGUI() { if (!initialized) { return; } var editorConfig = ProjectFolders.Instance; var assetManageConfig = AssetManageConfig.Instance; var externalResourcesPath = editorConfig.ExternalResourcesPath; EditorGUILayout.Separator(); var backgroundColor = new Color(0.3f, 0.3f, 0.5f); var labelColor = new Color(0.8f, 0.8f, 0.8f, 0.8f); EditorLayoutTools.DrawLabelWithBackground("AssetInfoManifest", backgroundColor, labelColor); if (GUILayout.Button("Generate")) { // アセット情報ファイルを生成. AssetInfoManifestGenerator.Generate(externalResourcesPath, assetManageConfig); } GUILayout.Space(6f); EditorLayoutTools.DrawLabelWithBackground("ExternalResource", backgroundColor, labelColor); if (GUILayout.Button("Generate")) { if (ExternalResourceManager.BuildConfirm()) { var build = true; #if ENABLE_CRIWARE_ADX || ENABLE_CRIWARE_SOFDEC // CRIの最新アセットに更新. CriAssetUpdater.Execute(); #endif try { EditorApplication.LockReloadAssemblies(); // アセット情報ファイルを生成. AssetInfoManifestGenerator.Generate(externalResourcesPath, assetManageConfig); // 依存関係の検証. var validate = AssetDependencies.Validate(externalResourcesPath); if (!validate) { var messeage = "There is an incorrect reference.\nDo you want to cancel the build?"; if (!EditorUtility.DisplayDialog("InvalidDependant", messeage, "build", "cancel")) { build = false; // ExternalResourceフォルダ以外の参照が含まれる場合は依存関係を表示. InvalidDependantWindow.Open(externalResourcesPath); } } // ビルド. if (build) { ExternalResourceManager.Build(externalResourcesPath, assetManageConfig); } } finally { EditorApplication.UnlockReloadAssemblies(); } } } EditorGUILayout.Separator(); }
void OnGUI() { var setterInspector = GameTextSetterInspector.Current; if (setterInspector == null) { EditorGUILayout.HelpBox("Need Select GameTextSetter GameObject.", MessageType.Info); return; } var setter = GameTextSetterInspector.Current.Instance; if (setter == null) { return; } if (category != setter.Category) { BuildSelectionInfos(); } GUILayout.Space(12f); GUILayout.BeginHorizontal(GUILayout.MinHeight(20f)); { GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); { string before = searchText; string after = EditorGUILayout.TextField(string.Empty, before, "SearchTextField", GUILayout.Width(200f)); if (before != after) { searchText = after; scrollPos = Vector2.zero; } if (GUILayout.Button(string.Empty, "SearchCancelButton", GUILayout.Width(18f))) { searchText = string.Empty; GUIUtility.keyboardControl = 0; scrollPos = Vector2.zero; } } GUILayout.EndHorizontal(); GUILayout.Space(15f); if (GUILayout.Button("Clear", GUILayout.Width(70f), GUILayout.Height(16f))) { setter.SetCategoryId(null); } GUILayout.Space(10f); } GUILayout.EndHorizontal(); GUILayout.Space(5f); if (selectionCache.Any()) { EditorGUILayout.Separator(); var infos = GetMatchOfList(); using (new EditorGUILayout.VerticalScope()) { EditorLayoutTools.DrawLabelWithBackground("Category : " + setter.Category.ToLabelName(), new Color(0.2f, 0.5f, 0.2f)); using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPos)) { foreach (var info in infos) { GUILayout.Space(-1f); var highlight = setter.Identifier.ToNullable() == info.Id; var originBackgroundColor = GUI.backgroundColor; using (new BackgroundColorScope(highlight ? new Color(0.9f, 1f, 0.9f) : new Color(0.95f, 0.95f, 0.95f))) { var size = EditorStyles.label.CalcSize(new GUIContent(info.Text)); size.y += 6f; using (new EditorGUILayout.HorizontalScope(EditorLayoutTools.TextAreaStyle, GUILayout.Height(size.y))) { var labelStyle = new GUIStyle("IN TextField") { alignment = TextAnchor.MiddleLeft, }; GUILayout.Space(10f); GUILayout.Label(info.Id.ToString(), labelStyle, GUILayout.MinWidth(65f), GUILayout.Height(size.y)); GUILayout.Label(info.Name, labelStyle, GUILayout.MinWidth(220f), GUILayout.Height(size.y)); GUILayout.Label(info.Text, labelStyle, GUILayout.MaxWidth(500f), GUILayout.Height(size.y)); GUILayout.FlexibleSpace(); using (new EditorGUILayout.VerticalScope()) { var buttonHeight = 20f; GUILayout.Space((size.y - buttonHeight) * 0.5f); using (new BackgroundColorScope(originBackgroundColor)) { if (GUILayout.Button("Select", GUILayout.Width(75f), GUILayout.Height(buttonHeight))) { UnityEditorUtility.RegisterUndo("GameTextSelector-Select", setter); setter.SetCategoryId(info.Id); setterInspector.Repaint(); Close(); } } GUILayout.Space((size.y - buttonHeight) * 0.5f); } GUILayout.Space(8f); } } } scrollPos = scrollViewScope.scrollPosition; } } } else { EditorGUILayout.HelpBox("GameText Notfound", MessageType.Warning); } }
void OnGUI() { var originLabelWidth = EditorLayoutTools.SetLabelWidth(50f); if (referenceInfo != null) { GUILayout.Space(15f); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Space(5f); using (new EditorGUILayout.VerticalScope()) { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.ObjectField("Target", targetAsset, typeof(Object), false, GUILayout.Width(250f)); GUILayout.Space(15f); displayType = (DisplayType)EditorGUILayout.EnumPopup(displayType, GUILayout.Width(60f)); GUILayout.FlexibleSpace(); } GUILayout.Space(5f); EditorLayoutTools.DrawLabelWithBackground("References", EditorLayoutTools.BackgroundColor, EditorLayoutTools.LabelColor); using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition)) { foreach (var item in referenceInfo.Dependencies) { switch (displayType) { case DisplayType.Asset: EditorGUILayout.ObjectField(item.Value, typeof(Object), false); break; case DisplayType.Path: using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.SelectableLabel(item.Key, EditorStyles.textArea, GUILayout.Height(18f)); GUILayout.Space(5f); if (GUILayout.Button("select", GUILayout.Width(50f))) { Selection.activeObject = item.Value; } } break; } GUILayout.Space(2f); } scrollPosition = scrollViewScope.scrollPosition; } GUILayout.Space(5f); } GUILayout.Space(5f); } GUILayout.Space(15f); } else { EditorGUILayout.HelpBox("This object is not referenced.", MessageType.Info); } EditorLayoutTools.SetLabelWidth(originLabelWidth); }
void OnGUI() { if (!initialized) { Initialize(); } EditorGUILayout.Separator(); using (new EditorGUILayout.HorizontalScope()) { var config = TextureAssetTunerConfig.Instance; if (GUILayout.Button(viewToolZoomIcon, EditorStyles.miniButton, GUILayout.Width(24f), GUILayout.Height(15f))) { var allFolders = config.CompressFolders; compressFolderInfos = GetCompressFolderInfo(allFolders); textureAssetInfos = null; viewMode = ViewMode.SelectFolder; Repaint(); } EditorGUILayout.ObjectField(config, typeof(TextureAssetTunerConfig), false, GUILayout.Width(400f)); if (viewMode == ViewMode.SearchResult) { if (GUILayout.Button(tabprevIcon, EditorStyles.miniButton, GUILayout.Width(30f), GUILayout.Height(15f))) { viewMode = ViewMode.SelectFolder; compressFolderScrollView.Contents = config.CompressFolders; } } GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); assetViewMode = (AssetViewMode)EditorGUILayout.EnumPopup(assetViewMode, GUILayout.Width(60f)); if (EditorGUI.EndChangeCheck()) { compressFolderScrollView.AssetViewMode = assetViewMode; textureAssetInfoScrollView.AssetViewMode = assetViewMode; Repaint(); } var originLabelWidth = EditorLayoutTools.SetLabelWidth(70f); EditorGUI.BeginChangeCheck(); failedOnly = EditorGUILayout.Toggle("Failed Only", failedOnly, GUILayout.Width(90f)); if (EditorGUI.EndChangeCheck()) { if (viewMode == ViewMode.SearchResult) { textureAssetInfoScrollView.Contents = GetFilteredTextureAssetInfos(); } Repaint(); } EditorLayoutTools.SetLabelWidth(originLabelWidth); GUILayout.Space(5f); } EditorGUILayout.Separator(); EditorLayoutTools.DrawLabelWithBackground("Assets"); switch (viewMode) { case ViewMode.SelectFolder: compressFolderScrollView.CompressFolderInfos = compressFolderInfos; compressFolderScrollView.Draw(); break; case ViewMode.SearchResult: textureAssetInfoScrollView.Draw(); break; } }
void OnGUI() { var backgroundColor = new Color(0.5f, 0.5f, 0.5f, 0.3f); EditorGUILayout.Separator(); var acbPath = selectAcbAsset != null?AssetDatabase.GetAssetPath(selectAcbAsset) : null; if (!string.IsNullOrEmpty(acbPath)) { EditorLayoutTools.DrawLabelWithBackground("CueSheet", backgroundColor); GUILayout.Space(5f); EditorGUILayout.ObjectField(selectAcbAsset, typeof(Object), false); EditorGUILayout.Separator(); if (acbPath.StartsWith(resourceDir)) { var resourcePath = string.Empty; resourcePath = UnityPathUtility.GetLocalPath(acbPath, resourceDir); resourcePath = PathUtility.GetPathWithoutExtension(resourcePath); EditorLayoutTools.DrawLabelWithBackground("Resource Path", backgroundColor); GUILayout.Space(5f); using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("copy", GUILayout.Width(40f))) { GUIUtility.systemCopyBuffer = resourcePath; } EditorGUILayout.SelectableLabel(resourcePath, EditorStyles.textArea, GUILayout.Height(18f)); } } } if (string.IsNullOrEmpty(acbPath)) { EditorGUILayout.HelpBox("Drag and drop Acb asset.", MessageType.Info); } EditorGUILayout.Separator(); if (!string.IsNullOrEmpty(acbPath)) { if (isLoaded && cueInfos != null) { if (cueInfos.IsEmpty()) { EditorGUILayout.HelpBox("CueSheet dont have Cue.", MessageType.Warning); } else { EditorLayoutTools.DrawLabelWithBackground("Cue", backgroundColor); GUILayout.Space(5f); using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPosition)) { foreach (var cueInfo in cueInfos) { using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("copy", GUILayout.Width(40f))) { GUIUtility.systemCopyBuffer = cueInfo.Cue; } GUIContent contentText = null; if (string.IsNullOrEmpty(cueInfo.Summary)) { contentText = new GUIContent(cueInfo.Cue); } else { var tooltip = string.Format("[{0}]\n{1}", cueInfo.Cue, cueInfo.Summary); contentText = new GUIContent(cueInfo.Cue, tooltip); } GUILayout.Label(contentText, GUILayout.Height(18f)); } GUILayout.Space(2f); } scrollPosition = scrollViewScope.scrollPosition; } } } GUILayout.FlexibleSpace(); } EditorGUILayout.Separator(); UpdateDragAndDrop(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); instance = target as ButtonReactiveImage; if (instance.Atlas != null) { var backgroundColor = new Color(0.3f, 0.3f, 0.5f); var labelColor = new Color(0.8f, 0.8f, 0.8f, 0.8f); if (instance.Atlas.Sprites.Any()) { EditorGUILayout.Separator(); EditorLayoutTools.DrawLabelWithBackground("EnableSprite", backgroundColor, labelColor); using (new GUILayout.HorizontalScope()) { var enableSpriteName = Reflection.GetPrivateField <ButtonReactiveImage, string>(instance, "enableSpriteName"); GUILayout.Space(5f); if (EditorLayoutTools.DrawPrefixButton("Sprite")) { EditorAtlasPrefs.atlas = instance.Atlas; EditorAtlasPrefs.selectedSprite = enableSpriteName; AtlasSpriteSelector.Show(SelectEnableSprite); } if (!string.IsNullOrEmpty(enableSpriteName)) { EditorGUILayout.SelectableLabel(enableSpriteName, EditorStyles.textArea, GUILayout.Height(18f)); } } EditorGUILayout.Separator(); EditorLayoutTools.DrawLabelWithBackground("DisableSprite", backgroundColor, labelColor); using (new GUILayout.HorizontalScope()) { var disableSpriteName = Reflection.GetPrivateField <ButtonReactiveImage, string>(instance, "disableSpriteName"); GUILayout.Space(5f); if (EditorLayoutTools.DrawPrefixButton("Sprite")) { EditorAtlasPrefs.atlas = instance.Atlas; EditorAtlasPrefs.selectedSprite = disableSpriteName; AtlasSpriteSelector.Show(SelectDisableSprite); } if (!string.IsNullOrEmpty(disableSpriteName)) { EditorGUILayout.SelectableLabel(disableSpriteName, EditorStyles.textArea, GUILayout.Height(18f)); } } } else { EditorGUILayout.HelpBox("No sprites found", MessageType.Warning); } } }