private void DrawFolderButton(string folderName) { if (GUILayout.Toggle(_selectedFolder == folderName, folderName, GetFolderStyle(folderName))) { if (_selectedFolder != folderName) { _selectedFolder = folderName; System.RequestMiniaturesIfNeeded(_selectedFolder); _selectedImage = 0; Miniatures.Clear(); } } else { if (_selectedFolder == folderName) { _selectedFolder = null; Miniatures.Clear(); } } }
public void DrawLibraryContent(int windowId) { //Always draw close button first DrawCloseButton(() => _selectedFolder = null, _libraryWindowRect); GUILayout.BeginVertical(); GUI.DragWindow(MoveRect); DrawRefreshButton(() => { _selectedImage = 0; System.MessageSender.RequestMiniatures(_selectedFolder); Miniatures.Clear(); }); GUILayout.Space(15); if (string.IsNullOrEmpty(_selectedFolder)) { return; } GUILayout.BeginVertical(); _libraryScrollPos = GUILayout.BeginScrollView(_libraryScrollPos); if (Miniatures.Any()) { for (var i = 0; i < Miniatures.Count; i += 4) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); DrawMiniature(Miniatures[i]); GUILayout.FlexibleSpace(); if (Miniatures.Count > i + 1) { GUILayout.FlexibleSpace(); DrawMiniature(Miniatures[i + 1]); GUILayout.FlexibleSpace(); } if (Miniatures.Count > i + 2) { GUILayout.FlexibleSpace(); DrawMiniature(Miniatures[i + 2]); GUILayout.FlexibleSpace(); } if (Miniatures.Count > i + 3) { GUILayout.FlexibleSpace(); DrawMiniature(Miniatures[i + 3]); GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } } else { DrawWaitIcon(false); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndVertical(); }