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

View File

@ -100,16 +100,16 @@ private void showScores()
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
if (scoreSource.Value != PlayBeatmapDetailArea.TabType.Local)
{
if (TrackedScore?.ScorePosition == Flow.Count && Flow.Count > GetScoresRequest.MAX_SCORES_PER_REQUEST)
TrackedScore.ScorePosition = null;
if (i == Flow.Count && Flow.Count > GetScoresRequest.MAX_SCORES_PER_REQUEST)
return false;
}
return base.CheckValidScorePosition(i);
}
private void updateVisibility() =>