Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added left and right directional buttons #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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