From f03ada65ddec5c5b38f125bf49b776a0c80a5f0a Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Thu, 27 Feb 2020 22:23:50 +0100 Subject: [PATCH] Adjust grade columns spacing --- .../Overlays/Rankings/Tables/RankingsTable.cs | 10 +++++++--- .../Overlays/Rankings/Tables/UserBasedTable.cs | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index 943897581e..946bd82cf8 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; @@ -96,19 +96,23 @@ namespace osu.Game.Overlays.Rankings.Tables } }; + protected virtual IEnumerable GradeColumns() => new List(); + protected virtual string HighlightedColumn() => @"Performance"; private class HeaderText : OsuSpriteText { private readonly string highlighted; - public HeaderText(string text, string highlighted) + public HeaderText(string text, string highlighted, IEnumerable gradeColumns) { this.highlighted = highlighted; Text = text; Font = OsuFont.GetFont(size: 12); - Margin = new MarginPadding { Horizontal = 10 }; + + var isGrade = gradeColumns.Contains(text); + Margin = new MarginPadding { Vertical = 5, Horizontal = isGrade ? 20 : 10 }; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs index cad7364103..8eecffd738 100644 --- a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; @@ -19,16 +19,18 @@ namespace osu.Game.Overlays.Rankings.Tables { } - protected override TableColumn[] CreateAdditionalHeaders() => new[] + protected override IEnumerable GradeColumns() => new List() { "SS", "S", "A" }; + + protected override TableColumn[] CreateAdditionalHeaders() { + var gradeColumns = GradeColumns().Select(grade => new TableColumn(grade, Anchor.Centre, new Dimension(GridSizeMode.AutoSize))); + + return new[] + { new TableColumn("Accuracy", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), new TableColumn("Play Count", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), - }.Concat(CreateUniqueHeaders()).Concat(new[] - { - new TableColumn("SS", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), - new TableColumn("S", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), - new TableColumn("A", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), - }).ToArray(); + }.Concat(CreateUniqueHeaders()).Concat(gradeColumns).ToArray(); + } protected sealed override Country GetCountry(UserStatistics item) => item.User.Country;