public static int AspectSelectionGrid(int selected, Texture[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
GUILayout.BeginVertical("box", options);
int num = 0;
doubleClick = false;
if (textures.Length != 0)
{
float num2 = (EditorGUIUtility.currentViewWidth - 20f) / ((float) approxSize);
int num3 = (int) Mathf.Ceil(((float) textures.Length) / num2);
Rect aspectRect = GUILayoutUtility.GetAspectRect(num2 / ((float) num3));
Event current = Event.current;
if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && aspectRect.Contains(current.mousePosition))
{
doubleClick = true;
current.Use();
}
num = GUI.SelectionGrid(aspectRect, selected, textures, Mathf.RoundToInt(EditorGUIUtility.currentViewWidth - 20f) / approxSize, style);
}
else
{
GUILayout.Label(emptyString, new GUILayoutOption[0]);
}
GUILayout.EndVertical();
return num;
}