2019-11-28 04:35:02 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2019-11-29 01:09:05 +08:00
|
|
|
|
using System.Collections.Generic;
|
2019-11-28 04:35:02 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Rankings.Tables
|
|
|
|
|
{
|
|
|
|
|
public abstract class UserBasedTable : RankingsTable<UserStatistics>
|
|
|
|
|
{
|
2019-11-29 01:09:05 +08:00
|
|
|
|
protected UserBasedTable(int page, IReadOnlyList<UserStatistics> rankings)
|
|
|
|
|
: base(page, rankings)
|
2019-11-28 04:35:02 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override TableColumn[] CreateAdditionalHeaders() => 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();
|
|
|
|
|
|
2019-11-28 18:07:43 +08:00
|
|
|
|
protected sealed override Country GetCountry(UserStatistics item) => item.User.Country;
|
2019-11-28 04:35:02 +08:00
|
|
|
|
|
2019-11-28 18:07:43 +08:00
|
|
|
|
protected sealed override Drawable CreateFlagContent(UserStatistics item)
|
2019-11-28 04:35:02 +08:00
|
|
|
|
{
|
|
|
|
|
var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: TEXT_SIZE)) { AutoSizeAxes = Axes.Both };
|
|
|
|
|
username.AddUserLink(item.User);
|
|
|
|
|
return username;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-28 18:07:43 +08:00
|
|
|
|
protected sealed override Drawable[] CreateAdditionalContent(UserStatistics item) => new[]
|
2019-11-28 04:35:02 +08:00
|
|
|
|
{
|
2020-02-03 23:12:34 +08:00
|
|
|
|
new ColoredRowText { Text = item.DisplayAccuracy, },
|
2019-11-28 18:07:43 +08:00
|
|
|
|
new ColoredRowText { Text = $@"{item.PlayCount:N0}", },
|
2019-11-28 04:35:02 +08:00
|
|
|
|
}.Concat(CreateUniqueContent(item)).Concat(new[]
|
|
|
|
|
{
|
2020-02-04 21:20:15 +08:00
|
|
|
|
new ColoredRowText { Text = $@"{item.GradesCount.SS + (item.GradesCount.SSPlus ?? 0):N0}", },
|
|
|
|
|
new ColoredRowText { Text = $@"{item.GradesCount.S + (item.GradesCount.SPlus ?? 0):N0}", },
|
2019-11-28 18:07:43 +08:00
|
|
|
|
new ColoredRowText { Text = $@"{item.GradesCount.A:N0}", }
|
2019-11-28 04:35:02 +08:00
|
|
|
|
}).ToArray();
|
|
|
|
|
|
|
|
|
|
protected abstract TableColumn[] CreateUniqueHeaders();
|
|
|
|
|
|
|
|
|
|
protected abstract Drawable[] CreateUniqueContent(UserStatistics item);
|
|
|
|
|
}
|
|
|
|
|
}
|