mirror of https://github.com/ppy/osu
Redirect through validity function rather than overriding `Sort`
This commit is contained in:
parent
20af8217f4
commit
aff218dfd5
|
@ -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()
|
||||
|
|
|
@ -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() =>
|
||||
|
|
Loading…
Reference in New Issue