UnityEditor.WebTemplateManagerBase.ThumbnailList C# (CSharp) Method

ThumbnailList() private static method

private static ThumbnailList ( Rect rect, int selection, GUIContent thumbnails, int maxRowItems ) : int
rect UnityEngine.Rect
selection int
thumbnails UnityEngine.GUIContent
maxRowItems int
return int
        private static int ThumbnailList(Rect rect, int selection, GUIContent[] thumbnails, int maxRowItems)
        {
            int num = 0;
            int index = 0;
            while (index < thumbnails.Length)
            {
                int num3 = 0;
                while ((num3 < maxRowItems) && (index < thumbnails.Length))
                {
                    if (ThumbnailListItem(new Rect(rect.x + (num3 * 80f), rect.y + (num * 100f), 80f, 100f), index == selection, thumbnails[index]))
                    {
                        selection = index;
                    }
                    num3++;
                    index++;
                }
                num++;
            }
            return selection;
        }

Usage Example

 public void SelectionUI(SerializedProperty templateProp)
 {
     if (WebTemplateManagerBase.s_Styles == null)
     {
         WebTemplateManagerBase.s_Styles = new WebTemplateManagerBase.Styles();
     }
     if (this.TemplateGUIThumbnails.Length < 1)
     {
         GUILayout.Label(EditorGUIUtility.TextContent("No templates found."), new GUILayoutOption[0]);
     }
     else
     {
         int  num     = Mathf.Min((int)Mathf.Max(((float)Screen.width - 30f) / 80f, 1f), this.TemplateGUIThumbnails.Length);
         int  num2    = Mathf.Max((int)Mathf.Ceil((float)this.TemplateGUIThumbnails.Length / (float)num), 1);
         bool changed = GUI.changed;
         templateProp.stringValue = this.Templates[WebTemplateManagerBase.ThumbnailList(GUILayoutUtility.GetRect((float)num * 80f, (float)num2 * 100f, new GUILayoutOption[]
         {
             GUILayout.ExpandWidth(false)
         }), this.GetTemplateIndex(templateProp.stringValue), this.TemplateGUIThumbnails, num)].ToString();
         bool flag     = !changed && GUI.changed;
         bool changed2 = GUI.changed;
         GUI.changed = false;
         string[] templateCustomKeys = PlayerSettings.templateCustomKeys;
         for (int i = 0; i < templateCustomKeys.Length; i++)
         {
             string text  = templateCustomKeys[i];
             string text2 = PlayerSettings.GetTemplateCustomValue(text);
             text2 = EditorGUILayout.TextField(WebTemplateManagerBase.PrettyTemplateKeyName(text), text2, new GUILayoutOption[0]);
             PlayerSettings.SetTemplateCustomValue(text, text2);
         }
         if (GUI.changed)
         {
             templateProp.serializedObject.Update();
         }
         GUI.changed |= changed2;
         if (flag)
         {
             GUIUtility.hotControl      = 0;
             GUIUtility.keyboardControl = 0;
             templateProp.serializedObject.ApplyModifiedProperties();
             PlayerSettings.templateCustomKeys = this.Templates[this.GetTemplateIndex(templateProp.stringValue)].CustomKeys;
             templateProp.serializedObject.Update();
         }
     }
 }
All Usage Examples Of UnityEditor.WebTemplateManagerBase::ThumbnailList