mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:32:55 +08:00
Post-process responses to populate positions
This commit is contained in:
parent
b361761d86
commit
4f3795486d
@ -244,6 +244,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
EndedAt = userScore.Date,
|
EndedAt = userScore.Date,
|
||||||
Passed = userScore.Passed,
|
Passed = userScore.Passed,
|
||||||
Rank = userScore.Rank,
|
Rank = userScore.Rank,
|
||||||
|
Position = 200,
|
||||||
MaxCombo = userScore.MaxCombo,
|
MaxCombo = userScore.MaxCombo,
|
||||||
TotalScore = userScore.TotalScore,
|
TotalScore = userScore.TotalScore,
|
||||||
User = userScore.User,
|
User = userScore.User,
|
||||||
|
@ -84,12 +84,18 @@ namespace osu.Game.Screens.Multi.Ranking
|
|||||||
{
|
{
|
||||||
allScores.AddRange(userScore.ScoresAround.Higher.Scores);
|
allScores.AddRange(userScore.ScoresAround.Higher.Scores);
|
||||||
higherScores = userScore.ScoresAround.Higher;
|
higherScores = userScore.ScoresAround.Higher;
|
||||||
|
|
||||||
|
Debug.Assert(userScore.Position != null);
|
||||||
|
setPositions(higherScores, userScore.Position.Value, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userScore.ScoresAround?.Lower != null)
|
if (userScore.ScoresAround?.Lower != null)
|
||||||
{
|
{
|
||||||
allScores.AddRange(userScore.ScoresAround.Lower.Scores);
|
allScores.AddRange(userScore.ScoresAround.Lower.Scores);
|
||||||
lowerScores = userScore.ScoresAround.Lower;
|
lowerScores = userScore.ScoresAround.Lower;
|
||||||
|
|
||||||
|
Debug.Assert(userScore.Position != null);
|
||||||
|
setPositions(lowerScores, userScore.Position.Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
performSuccessCallback(scoresCallback, allScores);
|
performSuccessCallback(scoresCallback, allScores);
|
||||||
@ -134,9 +140,15 @@ namespace osu.Game.Screens.Multi.Ranking
|
|||||||
indexReq.Success += r =>
|
indexReq.Success += r =>
|
||||||
{
|
{
|
||||||
if (pivot == lowerScores)
|
if (pivot == lowerScores)
|
||||||
|
{
|
||||||
lowerScores = r;
|
lowerScores = r;
|
||||||
|
setPositions(r, pivot, 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
higherScores = r;
|
higherScores = r;
|
||||||
|
setPositions(r, pivot, -1);
|
||||||
|
}
|
||||||
|
|
||||||
performSuccessCallback(scoresCallback, r.Scores, r);
|
performSuccessCallback(scoresCallback, r.Scores, r);
|
||||||
};
|
};
|
||||||
@ -183,6 +195,30 @@ namespace osu.Game.Screens.Multi.Ranking
|
|||||||
LeftSpinner.Hide();
|
LeftSpinner.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies positions to all <see cref="MultiplayerScore"/>s from a given pivot.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="scores">The <see cref="MultiplayerScores"/> to set positions on.</param>
|
||||||
|
/// <param name="pivot">The pivot.</param>
|
||||||
|
/// <param name="increment">The amount to increment the pivot position by for each <see cref="MultiplayerScore"/> in <paramref name="scores"/>.</param>
|
||||||
|
private void setPositions([NotNull] MultiplayerScores scores, [CanBeNull] MultiplayerScores pivot, int increment)
|
||||||
|
=> setPositions(scores, pivot?.Scores[^1].Position ?? 0, increment);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies positions to all <see cref="MultiplayerScore"/>s from a given pivot.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="scores">The <see cref="MultiplayerScores"/> to set positions on.</param>
|
||||||
|
/// <param name="pivotPosition">The pivot position.</param>
|
||||||
|
/// <param name="increment">The amount to increment the pivot position by for each <see cref="MultiplayerScore"/> in <paramref name="scores"/>.</param>
|
||||||
|
private void setPositions([NotNull] MultiplayerScores scores, int pivotPosition, int increment)
|
||||||
|
{
|
||||||
|
foreach (var s in scores.Scores)
|
||||||
|
{
|
||||||
|
pivotPosition += increment;
|
||||||
|
s.Position = pivotPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class PanelListLoadingSpinner : LoadingSpinner
|
private class PanelListLoadingSpinner : LoadingSpinner
|
||||||
{
|
{
|
||||||
private readonly ScorePanelList list;
|
private readonly ScorePanelList list;
|
||||||
|
Loading…
Reference in New Issue
Block a user