Script list is now sorted in alphabetical order #373

Merged
Pycorax merged 1 commits from SP3-6-c-scripting into main 2023-02-27 17:24:29 +08:00
1 changed files with 10 additions and 0 deletions

View File

@ -903,6 +903,12 @@ namespace SHADE
{
return pair->type;
}
/* Sort */
System::String^ sortKeyAccessor(System::Type^ type)
{
return type->Name;
}
}
void ScriptStore::refreshScriptTypeList()
@ -926,6 +932,10 @@ namespace SHADE
Func<Pair^, Type^>^ selector = gcnew Func<Pair^, Type^>(selectorFunc);
scriptTypeList = Enumerable::Select(whereResult, selector);
/* Sort: By Alphabetical Order */
Func<Type^, String^>^ sorter = gcnew Func<Type^, String^>(sortKeyAccessor);
scriptTypeList = Enumerable::OrderBy(scriptTypeList, sorter);
// Log
std::ostringstream oss;
oss << "[ScriptStore] Successfully retrieved references to " << Enumerable::Count(scriptTypeList)