0.3.0: Added history list
This commit is contained in:
parent
1e1736f94a
commit
9b73200c73
38 changed files with 662 additions and 18 deletions
71
Editor/History/Window/EditorHistoryWindow.cs
Normal file
71
Editor/History/Window/EditorHistoryWindow.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Game.NavigationTool.Editor.History
|
||||
{
|
||||
internal sealed class EditorHistoryWindow : EditorWindow
|
||||
{
|
||||
[NonSerialized]
|
||||
private Styles styles;
|
||||
[SerializeField]
|
||||
public EditorHistoryViewTools viewTools;
|
||||
[SerializeField]
|
||||
private EditorHistoryViewSearchList viewSearchList;
|
||||
|
||||
[MenuItem("Tools/Windows/History")]
|
||||
public static void Open()
|
||||
{
|
||||
var window = GetWindow<EditorHistoryWindow>();
|
||||
window.titleContent = new GUIContent("History");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (styles == null)
|
||||
styles = new Styles();
|
||||
if (viewTools == null)
|
||||
viewTools = new EditorHistoryViewTools();
|
||||
if (viewSearchList == null)
|
||||
viewSearchList = new EditorHistoryViewSearchList();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (Event.current.type == EventType.Layout)
|
||||
return;
|
||||
|
||||
styles.Initialize(GUI.skin);
|
||||
var rectTools = new Rect(0.0f, 0.0f, position.width, EditorGUIUtility.singleLineHeight);
|
||||
var rectList = new Rect(0.0f, rectTools.yMax, position.width, position.height - rectTools.height);
|
||||
|
||||
viewTools.Initialize();
|
||||
viewTools.Draw(this, rectTools, styles);
|
||||
|
||||
viewSearchList.Initialize();
|
||||
viewSearchList.Draw(this, rectList, styles);
|
||||
|
||||
HandleClickEvent();
|
||||
}
|
||||
|
||||
private void HandleClickEvent()
|
||||
{
|
||||
if (!HistoryGUIUtility.isClicked)
|
||||
return;
|
||||
|
||||
HistoryList historyList = HistoryUtility.GetHistoryList();
|
||||
Object obj = historyList.GetObject(HistoryGUIUtility.currentEntry);
|
||||
|
||||
if (obj != null)
|
||||
{
|
||||
HistoryListPostProcess.IgnoreNextSelectionChange();
|
||||
Selection.activeObject = obj;
|
||||
EditorGUIUtility.PingObject(obj);
|
||||
}
|
||||
|
||||
HistoryGUIUtility.Used();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue