1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Redirect through validity function rather than overriding Sort

This commit is contained in:
Dean Herbert 2022-11-18 15:52:39 +09:00
parent 20af8217f4
commit aff218dfd5
2 changed files with 10 additions and 8 deletions

View File

@ -62,7 +62,7 @@ namespace osu.Game.Screens.Play.HUD
{ {
base.LoadComplete(); base.LoadComplete();
Scheduler.AddDelayed(Sort, 1000, true); Scheduler.AddDelayed(sort, 1000, true);
} }
/// <summary> /// <summary>
@ -158,7 +158,7 @@ namespace osu.Game.Screens.Play.HUD
} }
} }
protected virtual void Sort() private void sort()
{ {
if (sorting.IsValid) if (sorting.IsValid)
return; return;
@ -171,12 +171,14 @@ namespace osu.Game.Screens.Play.HUD
for (int i = 0; i < Flow.Count; i++) for (int i = 0; i < Flow.Count; i++)
{ {
Flow.SetLayoutPosition(orderedByScore[i], i); Flow.SetLayoutPosition(orderedByScore[i], i);
orderedByScore[i].ScorePosition = i + 1; orderedByScore[i].ScorePosition = CheckValidScorePosition(i + 1) ? i + 1 : null;
} }
sorting.Validate(); sorting.Validate();
} }
protected virtual bool CheckValidScorePosition(int i) => true;
private class InputDisabledScrollContainer : OsuScrollContainer private class InputDisabledScrollContainer : OsuScrollContainer
{ {
public InputDisabledScrollContainer() public InputDisabledScrollContainer()

View File

@ -100,16 +100,16 @@ namespace osu.Game.Screens.Play.HUD
local.DisplayOrder.Value = long.MaxValue; local.DisplayOrder.Value = long.MaxValue;
} }
protected override void Sort() protected override bool CheckValidScorePosition(int i)
{ {
base.Sort();
// change displayed position to '-' when there are 50 already submitted scores and tracked score is last // change displayed position to '-' when there are 50 already submitted scores and tracked score is last
if (scoreSource.Value != PlayBeatmapDetailArea.TabType.Local) if (scoreSource.Value != PlayBeatmapDetailArea.TabType.Local)
{ {
if (TrackedScore?.ScorePosition == Flow.Count && Flow.Count > GetScoresRequest.MAX_SCORES_PER_REQUEST) if (i == Flow.Count && Flow.Count > GetScoresRequest.MAX_SCORES_PER_REQUEST)
TrackedScore.ScorePosition = null; return false;
} }
return base.CheckValidScorePosition(i);
} }
private void updateVisibility() => private void updateVisibility() =>