From 6df595cb920c906d227df3da73c2764a61a7650c Mon Sep 17 00:00:00 2001 From: Tamion <70228790+notTamion@users.noreply.github.com> Date: Sun, 29 Sep 2024 21:24:56 +0200 Subject: [PATCH] Sort Mod Options Alphabetically --- Celeste.Mod.mm/Mod/UI/OuiModOptions.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs b/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs index 2d1023f18..21f4b67c0 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs @@ -119,6 +119,11 @@ public static TextMenu CreateMenu(bool inGame, EventInstance snapshot) { // reorder Mod Options according to the modoptionsorder.txt file. List modules = new List(Everest._Modules); + // sort by Mod names and move everest to the beginning + EverestModule everest = modules[0]; + modules.RemoveAt(0); + modules = modules.OrderBy(module => module.Metadata.Name).ToList(); + modules.Insert(0, everest); if (Everest.Loader._ModOptionsOrder != null && Everest.Loader._ModOptionsOrder.Count > 0) { foreach (string modName in Everest.Loader._ModOptionsOrder) { if (modName.Equals("Everest", StringComparison.InvariantCultureIgnoreCase)) { @@ -202,15 +207,15 @@ static public Action AddSearchBox(TextMenu menu, Overworld overworld = null) { string searchTarget = textBox.Text.ToLower(); List menuItems = ((patch_TextMenu) menu).Items; - bool searchNextPredicate(TextMenu.Item item) { - if (!item.Visible || !item.Selectable || item.Disabled) - return false; - int index = menu.IndexOf(item); - if (index > 0 && (menu as patch_TextMenu).Items[index - 1] is patch_TextMenu.patch_SubHeader subHeader) { - if (subHeader.Title != null && subHeader.Title.ToLower().Contains(searchTarget)) { - return true; - } - } + bool searchNextPredicate(TextMenu.Item item) { + if (!item.Visible || !item.Selectable || item.Disabled) + return false; + int index = menu.IndexOf(item); + if (index > 0 && (menu as patch_TextMenu).Items[index - 1] is patch_TextMenu.patch_SubHeader subHeader) { + if (subHeader.Title != null && subHeader.Title.ToLower().Contains(searchTarget)) { + return true; + } + } string searchLabel = ((patch_TextMenu.patch_Item) item).SearchLabel(); return searchLabel != null && searchLabel.ToLower().Contains(searchTarget); }