From ce66d0c1f9bde78610fccde03346dbe5cb53f262 Mon Sep 17 00:00:00 2001 From: RN Date: Sat, 26 Nov 2016 01:03:47 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=96=E3=83=83=E3=82=AF=E3=83=9E=E3=83=BC?= =?UTF-8?q?=E3=82=AF=E5=89=8A=E9=99=A4=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssetBookmarker/Editor/BookmarkWindow.cs | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Assets/AssetBookmarker/Editor/BookmarkWindow.cs b/Assets/AssetBookmarker/Editor/BookmarkWindow.cs index 961cc39..dffcf7f 100644 --- a/Assets/AssetBookmarker/Editor/BookmarkWindow.cs +++ b/Assets/AssetBookmarker/Editor/BookmarkWindow.cs @@ -53,7 +53,6 @@ void OnGUI() } EditorGUILayout.LabelField("ブックマークしたアセット一覧を表示します"); - this.list.DoLayoutList(); } @@ -110,23 +109,33 @@ void CreateList() rect.height -= 4; var labelRect = new Rect(rect); - labelRect.width = 17f; + labelRect.width = 13f; + + var buttonRect = new Rect(rect); + buttonRect.x += labelRect.width + 8f; + buttonRect.width = 20f; + buttonRect.y += 1f; + buttonRect.height -= 2f; var objectRect = new Rect(rect); - objectRect.width -= labelRect.width; - objectRect.x += labelRect.width; + objectRect.width -= labelRect.width + buttonRect.width + 18f; + objectRect.x += labelRect.width + buttonRect.width + 16f; EditorGUI.LabelField(labelRect, index.ToString()); - EditorGUI.BeginChangeCheck(); var asset = (Object)list.list[index]; asset = EditorGUI.ObjectField(objectRect, asset, typeof(Object), false); if (EditorGUI.EndChangeCheck()) { - Debug.Log("Changed"); list.list[index] = asset; EditorUtility.SetDirty(_data); } + + // remove + if (GUI.Button(buttonRect, "-")) + { + this.DoRemoveButton(list, index); + } }; // フッター描画 @@ -148,5 +157,17 @@ void CreateList() EditorUtility.SetDirty(_data); }; } + + /// + /// 要素の削除 + /// + public void DoRemoveButton(ReorderableList list, int index) + { + EditorApplication.delayCall += () => + { + list.list.RemoveAt(index); + this.Repaint(); + }; + } } }