Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ public class ProjectBookmarkWindow : BookmarkWindowBase
/// Label領域の大きさ
/// </summary>
private const float LabelWidth = 68f;


/// <summary>
/// Directional button size
/// </summary>
private const float DirButtonWidth = 16f;

/// <summary>
/// ボタンの大きさ
/// </summary>
Expand All @@ -44,7 +49,7 @@ public class ProjectBookmarkWindow : BookmarkWindowBase
/// 現在選択しているブックマークデータ名
/// </summary>
[SerializeField] private string currentBookmarkName;

/// <summary>
/// ブックマーク情報
/// </summary>
Expand All @@ -54,9 +59,12 @@ public class ProjectBookmarkWindow : BookmarkWindowBase
private static bool needReloadData = false;
private static Object[] willRegisterAssets = null;

private static GUIContent prevIcon;
private static GUIContent nextIcon;

/// <summary>
/// アセットのロード時に呼ばれる
/// </summary>
/// </summary>
[DidReloadScripts]
[InitializeOnLoadMethodAttribute]
public static void OnLoadAssets()
Expand Down Expand Up @@ -89,20 +97,42 @@ private void OnGUI()
{
this.RebuildBookmarkList();
}

if (willRegisterAssets != null)
{
var data = this.bookmarkDatas[this.currentBookmarkIndex];
var data = this.bookmarkDatas[this.currentBookmarkIndex];
data.Assets.AddRange(willRegisterAssets);
EditorUtility.SetDirty(data);
willRegisterAssets = null;
}

prevIcon ??= EditorGUIUtility.IconContent("d_Profiler.PrevFrame");
nextIcon ??= EditorGUIUtility.IconContent("d_Profiler.NextFrame");

EditorGUILayout.LabelField(MenuConfig.GUI_WINDOW_PROJECT_TEXT_OVERVIEW);
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUILayout.LabelField("Bookmark", GUILayout.Width(LabelWidth));
int index = EditorGUILayout.Popup(this.currentBookmarkIndex, this.popupDisplayedOptions);

int dirIndex = currentBookmarkIndex;

EditorGUIUtility.SetIconSize(new Vector2(14, 14));
if (GUILayout.Button(prevIcon, EditorStyles.miniButton, GUILayout.Width(DirButtonWidth)))
{
if (dirIndex > 0) --dirIndex;
}

int index = EditorGUILayout.Popup(currentBookmarkIndex, popupDisplayedOptions);

EditorGUIUtility.SetIconSize(new Vector2(14, 14));
if (GUILayout.Button(nextIcon, EditorStyles.miniButton, GUILayout.Width(DirButtonWidth)))
{
if (dirIndex < bookmarkDatas.Length - 1) ++dirIndex;
}

if (index != currentBookmarkIndex) { }
else index = dirIndex;

if (EditorGUI.EndChangeCheck())
{
if (index < bookmarkDatas.Length)
Expand Down Expand Up @@ -255,7 +285,7 @@ static private void DoRemoveButton(ReorderableList list, int index)
window.Repaint();
};
}

/// <summary>
/// ウィンドウを開く
/// </summary>
Expand Down