mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 23:12:55 +08:00
Merge branch 'master' into catch-fruit-skinning
This commit is contained in:
commit
d82258ede6
@ -195,6 +195,29 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Position = 1337,
|
||||
};
|
||||
|
||||
var myBestScoreWithNullPosition = new APILegacyUserTopScoreInfo
|
||||
{
|
||||
Score = new APILegacyScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
Id = 7151382,
|
||||
Username = @"Mayuri Hana",
|
||||
Country = new Country
|
||||
{
|
||||
FullName = @"Thailand",
|
||||
FlagName = @"TH",
|
||||
},
|
||||
},
|
||||
Rank = ScoreRank.D,
|
||||
PP = 160,
|
||||
MaxCombo = 1234,
|
||||
TotalScore = 123456,
|
||||
Accuracy = 0.6543,
|
||||
},
|
||||
Position = null,
|
||||
};
|
||||
|
||||
var oneScore = new APILegacyScores
|
||||
{
|
||||
Scores = new List<APILegacyScoreInfo>
|
||||
@ -250,6 +273,12 @@ namespace osu.Game.Tests.Visual.Online
|
||||
allScores.UserScore = myBestScore;
|
||||
scoresContainer.Scores = allScores;
|
||||
});
|
||||
|
||||
AddStep("Load scores with null my best position", () =>
|
||||
{
|
||||
allScores.UserScore = myBestScoreWithNullPosition;
|
||||
scoresContainer.Scores = allScores;
|
||||
});
|
||||
}
|
||||
|
||||
private class TestScoresContainer : ScoresContainer
|
||||
|
@ -59,6 +59,33 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep(@"None selected", () => leaderboard.SetRetrievalState(PlaceholderState.NoneSelected));
|
||||
foreach (BeatmapSetOnlineStatus status in Enum.GetValues(typeof(BeatmapSetOnlineStatus)))
|
||||
AddStep($"{status} beatmap", () => showBeatmapWithStatus(status));
|
||||
AddStep("null personal best position", showPersonalBestWithNullPosition);
|
||||
}
|
||||
|
||||
private void showPersonalBestWithNullPosition()
|
||||
{
|
||||
leaderboard.TopScore = new APILegacyUserTopScoreInfo
|
||||
{
|
||||
Position = null,
|
||||
Score = new APILegacyScoreInfo
|
||||
{
|
||||
Rank = ScoreRank.XH,
|
||||
Accuracy = 1,
|
||||
MaxCombo = 244,
|
||||
TotalScore = 1707827,
|
||||
Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
|
||||
User = new User
|
||||
{
|
||||
Id = 6602580,
|
||||
Username = @"waaiiru",
|
||||
Country = new Country
|
||||
{
|
||||
FullName = @"Spain",
|
||||
FlagName = @"ES",
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void showPersonalBest()
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public class APILegacyUserTopScoreInfo
|
||||
{
|
||||
[JsonProperty(@"position")]
|
||||
public int Position;
|
||||
public int? Position;
|
||||
|
||||
[JsonProperty(@"score")]
|
||||
public APILegacyScoreInfo Score;
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
protected Container RankContainer { get; private set; }
|
||||
|
||||
private readonly ScoreInfo score;
|
||||
private readonly int rank;
|
||||
private readonly int? rank;
|
||||
private readonly bool allowHighlight;
|
||||
|
||||
private Box background;
|
||||
@ -58,7 +58,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
[Resolved(CanBeNull = true)]
|
||||
private DialogOverlay dialogOverlay { get; set; }
|
||||
|
||||
public LeaderboardScore(ScoreInfo score, int rank, bool allowHighlight = true)
|
||||
public LeaderboardScore(ScoreInfo score, int? rank, bool allowHighlight = true)
|
||||
{
|
||||
this.score = score;
|
||||
this.rank = rank;
|
||||
@ -90,7 +90,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 20, italics: true),
|
||||
Text = rank.ToMetric(decimals: rank < 100000 ? 1 : 0),
|
||||
Text = rank == null ? "-" : rank.Value.ToMetric(decimals: rank < 100000 ? 1 : 0),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
private readonly Box background;
|
||||
|
||||
public DrawableTopScore(ScoreInfo score, int position = 1)
|
||||
public DrawableTopScore(ScoreInfo score, int? position = 1)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
@ -112,9 +112,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
};
|
||||
}
|
||||
|
||||
public int ScorePosition
|
||||
public int? ScorePosition
|
||||
{
|
||||
set => rankText.Text = $"#{value}";
|
||||
set => rankText.Text = value == null ? "-" : $"#{value}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user