Move grade column spacing logic to UserBasedTable

This commit is contained in:
TheWildTree
2020-03-15 22:03:54 +01:00
parent f1e54d2745
commit db55b98ed3
3 changed files with 30 additions and 20 deletions

View File

@ -70,16 +70,12 @@ namespace osu.Game.Overlays.Rankings.Tables
protected abstract Drawable[] CreateAdditionalContent(TModel item);
protected virtual string HighlightedColumn => @"Performance";
protected override Drawable CreateHeader(int index, TableColumn column)
{
var title = column?.Header ?? string.Empty;
var isHighlighted = HighlightedColumn() == title;
var isGrade = GradeColumns().Contains(title);
return new HeaderText(title, isHighlighted)
{
Margin = new MarginPadding { Vertical = 5, Horizontal = isGrade ? 20 : 10 }
};
return new HeaderText(title, title == HighlightedColumn);
}
protected abstract Country GetCountry(TModel item);
@ -109,11 +105,7 @@ namespace osu.Game.Overlays.Rankings.Tables
}
};
protected virtual IEnumerable<string> GradeColumns() => new List<string>();
protected virtual string HighlightedColumn() => @"Performance";
private class HeaderText : OsuSpriteText
protected class HeaderText : OsuSpriteText
{
private readonly bool isHighlighted;
@ -123,6 +115,7 @@ namespace osu.Game.Overlays.Rankings.Tables
Text = text;
Font = OsuFont.GetFont(size: 12);
Margin = new MarginPadding { Vertical = 5, Horizontal = 10 };
}
[BackgroundDependencyLoader]