mirror of
https://github.com/maxartz15/SceneDebugViewer.git
synced 2024-11-24 04:35:33 +01:00
Added ScrollViewScope.
This commit is contained in:
parent
c207d4887e
commit
14d7e7eb41
@ -10,6 +10,7 @@ namespace TAO.SceneDebugViewer.Editor
|
|||||||
public static List<ReplacementShaderSetupScriptableObject> options = new List<ReplacementShaderSetupScriptableObject>();
|
public static List<ReplacementShaderSetupScriptableObject> options = new List<ReplacementShaderSetupScriptableObject>();
|
||||||
|
|
||||||
private GUIStyle optionsButtonStyle = null;
|
private GUIStyle optionsButtonStyle = null;
|
||||||
|
private Vector2 scrollPos;
|
||||||
|
|
||||||
[MenuItem("Window/Analysis/SceneDebugViewer")]
|
[MenuItem("Window/Analysis/SceneDebugViewer")]
|
||||||
static void Init()
|
static void Init()
|
||||||
@ -37,49 +38,54 @@ namespace TAO.SceneDebugViewer.Editor
|
|||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.position.width <= 101)
|
using (var scope = new GUILayout.ScrollViewScope(scrollPos, false, false))
|
||||||
{
|
{
|
||||||
// Compact grid.
|
scrollPos = scope.scrollPosition;
|
||||||
optionsButtonStyle = new GUIStyle(GUI.skin.button)
|
|
||||||
|
if (window.position.width <= 101)
|
||||||
{
|
{
|
||||||
alignment = TextAnchor.MiddleCenter,
|
// Compact grid.
|
||||||
fixedHeight = 44
|
optionsButtonStyle = new GUIStyle(GUI.skin.button)
|
||||||
};
|
|
||||||
|
|
||||||
for (int i = 0; i < options.Count; i += 2)
|
|
||||||
{
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
|
|
||||||
if (GUILayout.Button(options[i].Content.compact, optionsButtonStyle))
|
|
||||||
{
|
{
|
||||||
options[i].Replace();
|
alignment = TextAnchor.MiddleCenter,
|
||||||
}
|
fixedHeight = 44
|
||||||
|
};
|
||||||
|
|
||||||
if (i + 1 < options.Count)
|
for (int i = 0; i < options.Count; i += 2)
|
||||||
{
|
{
|
||||||
if (GUILayout.Button(options[i + 1].Content.compact, optionsButtonStyle))
|
GUILayout.BeginHorizontal();
|
||||||
|
|
||||||
|
if (GUILayout.Button(options[i].Content.compact, optionsButtonStyle))
|
||||||
{
|
{
|
||||||
options[i + 1].Replace();
|
options[i].Replace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i + 1 < options.Count)
|
||||||
|
{
|
||||||
|
if (GUILayout.Button(options[i + 1].Content.compact, optionsButtonStyle))
|
||||||
|
{
|
||||||
|
options[i + 1].Replace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
// Normal list.
|
|
||||||
optionsButtonStyle = new GUIStyle(GUI.skin.button)
|
|
||||||
{
|
{
|
||||||
alignment = TextAnchor.MiddleLeft,
|
// Normal list.
|
||||||
fixedHeight = 44
|
optionsButtonStyle = new GUIStyle(GUI.skin.button)
|
||||||
};
|
|
||||||
|
|
||||||
for (int i = 0; i < options.Count; i ++)
|
|
||||||
{
|
|
||||||
if (GUILayout.Button(options[i].Content.normal, optionsButtonStyle))
|
|
||||||
{
|
{
|
||||||
options[i].Replace();
|
alignment = TextAnchor.MiddleLeft,
|
||||||
|
fixedHeight = 44
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < options.Count; i ++)
|
||||||
|
{
|
||||||
|
if (GUILayout.Button(options[i].Content.normal, optionsButtonStyle))
|
||||||
|
{
|
||||||
|
options[i].Replace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user