* Implemented manual unstripping for ScrollView and Resize, should now work on any Unity 2018 or 2019 game.
* Fixed a bug with page view on the Scene Explorer
* Back-end cleanups
This commit is contained in:
sinaioutlander
2020-09-04 21:36:40 +10:00
parent 5de771389e
commit 6adaaf5500
17 changed files with 1002 additions and 103 deletions

View File

@ -75,11 +75,11 @@ namespace Explorer
var page = Pages[m_currentPage];
page.scroll = UIHelpers.BeginScrollView(page.scroll);
page.scroll = GUIUnstrip.BeginScrollView(page.scroll);
page.DrawWindow();
UIHelpers.EndScrollView();
GUIUnstrip.EndScrollView();
MainRect = ResizeDrag.ResizeWindow(MainRect, MainWindowID);

View File

@ -83,14 +83,14 @@ namespace Explorer
}
}
Pages.Count = allTransforms.Count;
Pages.ItemCount = allTransforms.Count;
int offset = Pages.CalculateOffsetIndex();
// sort by childcount
allTransforms.Sort((a, b) => b.childCount.CompareTo(a.childCount));
for (int i = offset; i < offset + Pages.PageLimit && i < Pages.Count; i++)
for (int i = offset; i < offset + Pages.ItemsPerPage && i < Pages.ItemCount; i++)
{
var child = allTransforms[i];
m_objectList.Add(new GameObjectCache(child.gameObject));
@ -124,7 +124,7 @@ namespace Explorer
{
m_searchResults = SearchSceneObjects(m_searchInput);
m_searching = true;
Pages.Count = m_searchResults.Count;
Pages.ItemCount = m_searchResults.Count;
}
public void CancelSearch()
@ -240,11 +240,13 @@ namespace Explorer
Pages.DrawLimitInputArea();
if (Pages.Count > Pages.PageLimit)
if (Pages.ItemCount > Pages.ItemsPerPage)
{
if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) }))
{
Pages.TurnPage(Turn.Left, ref this.scroll);
m_timeOfLastUpdate = -1f;
Update();
}
@ -253,6 +255,8 @@ namespace Explorer
if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) }))
{
Pages.TurnPage(Turn.Right, ref this.scroll);
m_timeOfLastUpdate = -1f;
Update();
}
}
@ -303,7 +307,7 @@ namespace Explorer
}
else
{
UIHelpers.FastGameobjButton(obj.RefGameObject,
UIHelpers.GOButton_Impl(obj.RefGameObject,
obj.EnabledColor,
obj.Label,
obj.RefGameObject.activeSelf,
@ -328,13 +332,13 @@ namespace Explorer
{
int offset = Pages.CalculateOffsetIndex();
for (int i = offset; i < offset + Pages.PageLimit && i < m_searchResults.Count; i++)
for (int i = offset; i < offset + Pages.ItemsPerPage && i < m_searchResults.Count; i++)
{
var obj = m_searchResults[i];
if (obj.RefGameObject)
{
UIHelpers.FastGameobjButton(obj.RefGameObject,
UIHelpers.GOButton_Impl(obj.RefGameObject,
obj.EnabledColor,
obj.Label,
obj.RefGameObject.activeSelf,

View File

@ -75,7 +75,7 @@ namespace Explorer
m_searchResults.Add(cache);
}
Pages.Count = m_searchResults.Count;
Pages.ItemCount = m_searchResults.Count;
Pages.PageOffset = 0;
}
@ -104,17 +104,16 @@ namespace Explorer
GUI.skin.label.alignment = TextAnchor.UpperLeft;
int count = m_searchResults.Count;
Pages.CalculateMaxOffset();
GUILayout.BeginHorizontal(null);
Pages.DrawLimitInputArea();
if (count > Pages.PageLimit)
if (count > Pages.ItemsPerPage)
{
// prev/next page buttons
if (Pages.Count > Pages.PageLimit)
if (Pages.ItemCount > Pages.ItemsPerPage)
{
if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) }))
{
@ -132,7 +131,7 @@ namespace Explorer
GUILayout.EndHorizontal();
resultsScroll = UIHelpers.BeginScrollView(resultsScroll);
resultsScroll = GUIUnstrip.BeginScrollView(resultsScroll);
var _temprect = new Rect(MainMenu.MainRect.x, MainMenu.MainRect.y, MainMenu.MainRect.width + 160, MainMenu.MainRect.height);
@ -142,7 +141,7 @@ namespace Explorer
//if (offset >= count) m_pageOffset = 0;
int offset = Pages.CalculateOffsetIndex();
for (int i = offset; i < offset + Pages.PageLimit && i < count; i++)
for (int i = offset; i < offset + Pages.ItemsPerPage && i < count; i++)
{
m_searchResults[i].Draw(MainMenu.MainRect, 0f);
//m_searchResults[i].DrawValue(MainMenu.MainRect);
@ -153,7 +152,7 @@ namespace Explorer
GUILayout.Label("<color=red><i>No results found!</i></color>", null);
}
UIHelpers.EndScrollView();
GUIUnstrip.EndScrollView();
GUILayout.EndVertical();
}
catch