diff --git a/Source/Editor/Content/GUI/ContentView.cs b/Source/Editor/Content/GUI/ContentView.cs index 3eeb18f51..32b5dc6c3 100644 --- a/Source/Editor/Content/GUI/ContentView.cs +++ b/Source/Editor/Content/GUI/ContentView.cs @@ -218,10 +218,10 @@ namespace FlaxEditor.Content.GUI /// Shows the items collection in the view. /// /// The items to show. + /// The sort method for items. /// If set to true items will be added to the current selection. Otherwise selection will be cleared before. public void ShowItems(List items, string sortMethod, bool additive = false) { - Console.WriteLine("GROS CON"); if (items == null) throw new ArgumentNullException(); @@ -250,28 +250,24 @@ namespace FlaxEditor.Content.GUI items[i].AddReference(this); } - // Sort items - ContentItem oui = (ContentItem) _children[0]; - Console.WriteLine("Ici " + oui); + // Sort items depending on sortMethod parameter _children.Sort(((control, control1) => { if (sortMethod == "Alphabetic Reverse") { - if (((ContentItem)control).CompareTo((ContentItem)control1) > 0) - return -1; - if (((ContentItem)control).CompareTo((ContentItem)control1) == 0) - return 0; - - + if (control.CompareTo(control1) > 0) + { + return -1; + } + if (control.CompareTo(control1) == 0) + { + return 0; + } return 1; } - - return (((ContentItem)control).CompareTo((ContentItem)control1)); - + return control.CompareTo(control1); })); - - // Unload and perform UI layout IsLayoutLocked = wasLayoutLocked; PerformLayout(); diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index a9ce2a367..8ad9f6256 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -39,7 +39,7 @@ namespace FlaxEditor.Windows private TextBox _foldersSearchBox; private TextBox _itemsSearchBox; private ViewDropdown _viewDropdown; - private string _sortBy; + private string _sortBy = "Alphabetic Order"; private RootContentTreeNode _root; @@ -220,7 +220,6 @@ namespace FlaxEditor.Windows var sortBy = menu.AddChildMenu("Sort by"); sortBy.ContextMenu.AddButton("Alphabetic Order", OnSortByButtonClicked); sortBy.ContextMenu.AddButton("Alphabetic Reverse", OnSortByButtonClicked); - sortBy.ContextMenu.AddButton("Last Modified", OnSortByButtonClicked); return menu; } @@ -240,7 +239,6 @@ namespace FlaxEditor.Windows { Editor.Windows.ContentWin._sortBy = button.Text; RefreshView(SelectedNode); - Console.WriteLine(Editor.Windows.ContentWin._sortBy); } ///