1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 22:23:22 +08:00

Adjust null handling

This commit is contained in:
Andrei Zavatski 2020-02-04 21:02:10 +03:00
parent f889f2435b
commit a9cfade2f4
2 changed files with 7 additions and 6 deletions

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Users;
using osu.Game.Scoring;
namespace osu.Game.Overlays.Rankings.Tables
{
@ -44,9 +45,9 @@ namespace osu.Game.Overlays.Rankings.Tables
new ColoredRowText { Text = $@"{item.PlayCount:N0}", },
}.Concat(CreateUniqueContent(item)).Concat(new[]
{
new ColoredRowText { Text = $@"{item.GradesCount.SS + (item.GradesCount.SSPlus ?? 0):N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.S + (item.GradesCount.SPlus ?? 0):N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.A:N0}", }
new ColoredRowText { Text = $@"{item.GradesCount[ScoreRank.XH] + item.GradesCount[ScoreRank.X]:N0}", },
new ColoredRowText { Text = $@"{item.GradesCount[ScoreRank.SH] + item.GradesCount[ScoreRank.S]:N0}", },
new ColoredRowText { Text = $@"{item.GradesCount[ScoreRank.A]:N0}", }
}).ToArray();
protected abstract TableColumn[] CreateUniqueHeaders();

View File

@ -85,20 +85,20 @@ namespace osu.Game.Users
[JsonProperty(@"a")]
public int A;
public int? this[ScoreRank rank]
public int this[ScoreRank rank]
{
get
{
switch (rank)
{
case ScoreRank.XH:
return SSPlus;
return SSPlus ?? 0;
case ScoreRank.X:
return SS;
case ScoreRank.SH:
return SPlus;
return SPlus ?? 0;
case ScoreRank.S:
return S;