mirror of
https://github.com/ppy/osu.git
synced 2025-01-24 17:13:16 +08:00
Merge branch 'master' into catch-fruit-skinning
This commit is contained in:
commit
d82258ede6
osu.Game.Tests/Visual
osu.Game
Online
Overlays/BeatmapSet/Scores
@ -195,6 +195,29 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Position = 1337,
|
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
|
var oneScore = new APILegacyScores
|
||||||
{
|
{
|
||||||
Scores = new List<APILegacyScoreInfo>
|
Scores = new List<APILegacyScoreInfo>
|
||||||
@ -250,6 +273,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
allScores.UserScore = myBestScore;
|
allScores.UserScore = myBestScore;
|
||||||
scoresContainer.Scores = allScores;
|
scoresContainer.Scores = allScores;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep("Load scores with null my best position", () =>
|
||||||
|
{
|
||||||
|
allScores.UserScore = myBestScoreWithNullPosition;
|
||||||
|
scoresContainer.Scores = allScores;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestScoresContainer : ScoresContainer
|
private class TestScoresContainer : ScoresContainer
|
||||||
|
@ -59,6 +59,33 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep(@"None selected", () => leaderboard.SetRetrievalState(PlaceholderState.NoneSelected));
|
AddStep(@"None selected", () => leaderboard.SetRetrievalState(PlaceholderState.NoneSelected));
|
||||||
foreach (BeatmapSetOnlineStatus status in Enum.GetValues(typeof(BeatmapSetOnlineStatus)))
|
foreach (BeatmapSetOnlineStatus status in Enum.GetValues(typeof(BeatmapSetOnlineStatus)))
|
||||||
AddStep($"{status} beatmap", () => showBeatmapWithStatus(status));
|
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()
|
private void showPersonalBest()
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
public class APILegacyUserTopScoreInfo
|
public class APILegacyUserTopScoreInfo
|
||||||
{
|
{
|
||||||
[JsonProperty(@"position")]
|
[JsonProperty(@"position")]
|
||||||
public int Position;
|
public int? Position;
|
||||||
|
|
||||||
[JsonProperty(@"score")]
|
[JsonProperty(@"score")]
|
||||||
public APILegacyScoreInfo Score;
|
public APILegacyScoreInfo Score;
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
protected Container RankContainer { get; private set; }
|
protected Container RankContainer { get; private set; }
|
||||||
|
|
||||||
private readonly ScoreInfo score;
|
private readonly ScoreInfo score;
|
||||||
private readonly int rank;
|
private readonly int? rank;
|
||||||
private readonly bool allowHighlight;
|
private readonly bool allowHighlight;
|
||||||
|
|
||||||
private Box background;
|
private Box background;
|
||||||
@ -58,7 +58,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private DialogOverlay dialogOverlay { get; set; }
|
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.score = score;
|
||||||
this.rank = rank;
|
this.rank = rank;
|
||||||
@ -90,7 +90,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Font = OsuFont.GetFont(size: 20, italics: true),
|
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;
|
private readonly Box background;
|
||||||
|
|
||||||
public DrawableTopScore(ScoreInfo score, int position = 1)
|
public DrawableTopScore(ScoreInfo score, int? position = 1)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
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>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user