mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
Make beatmap scores also support null position
This commit is contained in:
parent
1a689231c2
commit
d79ca97fe9
@ -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
|
||||
|
@ -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;
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -71,10 +70,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
topScoresContainer.Add(new DrawableTopScore(topScore));
|
||||
|
||||
if (userScoreInfo != null && userScoreInfo.OnlineScoreID != topScore.OnlineScoreID)
|
||||
{
|
||||
Debug.Assert(userScore.Position != null);
|
||||
topScoresContainer.Add(new DrawableTopScore(userScoreInfo, userScore.Position.Value));
|
||||
}
|
||||
topScoresContainer.Add(new DrawableTopScore(userScoreInfo, userScore.Position));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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