mirror of
https://github.com/ppy/osu.git
synced 2025-02-23 05:23:16 +08:00
Fix score position not being displayed in solo results screen
Closes https://github.com/ppy/osu/issues/31842. To be honest, I recall this working too, but I don't recall when it might have broken, nor do I want to go look for the point of breakage because it might be borderline impossible to find it now. So I'm just fixing as if it was just a straight omission. Opting for a client-side fix because server-side inclusion of the score position for an entire leaderboard has been previously rejected as too expensive: https://github.com/ppy/osu-web/pull/11354#discussion_r1689217450
This commit is contained in:
parent
3294450dc9
commit
288851c606
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Extensions;
|
||||
@ -35,7 +34,32 @@ namespace osu.Game.Screens.Ranking
|
||||
return null;
|
||||
|
||||
getScoreRequest = new GetScoresRequest(Score.BeatmapInfo, Score.Ruleset);
|
||||
getScoreRequest.Success += r => scoresCallback.Invoke(r.Scores.Where(s => !s.MatchesOnlineID(Score)).Select(s => s.ToScoreInfo(rulesets, Beatmap.Value.BeatmapInfo)));
|
||||
getScoreRequest.Success += r =>
|
||||
{
|
||||
var toDisplay = new List<ScoreInfo>();
|
||||
|
||||
for (int i = 0; i < r.Scores.Count; ++i)
|
||||
{
|
||||
var score = r.Scores[i];
|
||||
int position = i + 1;
|
||||
|
||||
if (score.MatchesOnlineID(Score))
|
||||
{
|
||||
// we don't want to add the same score twice, but also setting any properties of `Score` this late will have no visible effect,
|
||||
// so we have to fish out the actual drawable panel and set the position to it directly.
|
||||
var panel = ScorePanelList.GetPanelForScore(Score);
|
||||
Score.Position = panel.ScorePosition.Value = position;
|
||||
}
|
||||
else
|
||||
{
|
||||
var converted = score.ToScoreInfo(rulesets, Beatmap.Value.BeatmapInfo);
|
||||
converted.Position = position;
|
||||
toDisplay.Add(converted);
|
||||
}
|
||||
}
|
||||
|
||||
scoresCallback.Invoke(toDisplay);
|
||||
};
|
||||
return getScoreRequest;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user