1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-06 02:33:20 +08:00

Adjust grade columns spacing

This commit is contained in:
TheWildTree 2020-02-27 22:23:50 +01:00
parent 82cbd35e30
commit f03ada65dd
2 changed files with 17 additions and 11 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -96,19 +96,23 @@ namespace osu.Game.Overlays.Rankings.Tables
} }
}; };
protected virtual IEnumerable<string> GradeColumns() => new List<string>();
protected virtual string HighlightedColumn() => @"Performance"; protected virtual string HighlightedColumn() => @"Performance";
private class HeaderText : OsuSpriteText private class HeaderText : OsuSpriteText
{ {
private readonly string highlighted; private readonly string highlighted;
public HeaderText(string text, string highlighted) public HeaderText(string text, string highlighted, IEnumerable<string> gradeColumns)
{ {
this.highlighted = highlighted; this.highlighted = highlighted;
Text = text; Text = text;
Font = OsuFont.GetFont(size: 12); 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] [BackgroundDependencyLoader]

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
@ -19,16 +19,18 @@ namespace osu.Game.Overlays.Rankings.Tables
{ {
} }
protected override TableColumn[] CreateAdditionalHeaders() => new[] protected override IEnumerable<string> GradeColumns() => new List<string>() { "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("Accuracy", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
new TableColumn("Play Count", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), new TableColumn("Play Count", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
}.Concat(CreateUniqueHeaders()).Concat(new[] }.Concat(CreateUniqueHeaders()).Concat(gradeColumns).ToArray();
{ }
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();
protected sealed override Country GetCountry(UserStatistics item) => item.User.Country; protected sealed override Country GetCountry(UserStatistics item) => item.User.Country;