Fixed Guidebook Sorting / Ordering (#34960)
* fixed all yml and cs * Subjective Rearranging * fixed my accidentally removed xml endline * Accidentally included for a different PR * Added .ThenBy and cleaned up newplayer.yml
This commit is contained in:
@@ -133,24 +133,14 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
|
||||
HashSet<ProtoId<GuideEntryPrototype>> entries = new(_entries.Keys);
|
||||
foreach (var entry in _entries.Values)
|
||||
{
|
||||
if (entry.Children.Count > 0)
|
||||
{
|
||||
var sortedChildren = entry.Children
|
||||
.Select(childId => _entries[childId])
|
||||
.OrderBy(childEntry => childEntry.Priority)
|
||||
.ThenBy(childEntry => Loc.GetString(childEntry.Name))
|
||||
.Select(childEntry => new ProtoId<GuideEntryPrototype>(childEntry.Id))
|
||||
.ToList();
|
||||
|
||||
entry.Children = sortedChildren;
|
||||
}
|
||||
|
||||
entries.ExceptWith(entry.Children);
|
||||
}
|
||||
|
||||
rootEntries = entries.ToList();
|
||||
}
|
||||
|
||||
// Only roots need to be sorted.
|
||||
// As defined in the SS14 Dev Wiki, children are already sorted based on their child field order within their parent's prototype definition.
|
||||
// Roots are sorted by priority. If there is no defined priority for a root then it is by definition sorted undefined.
|
||||
return rootEntries
|
||||
.Select(rootEntryId => _entries[rootEntryId])
|
||||
.OrderBy(rootEntry => rootEntry.Priority)
|
||||
|
||||
Reference in New Issue
Block a user