mirror of https://github.com/ppy/osu
override `sort()` function in `SoloGameplayLeaderboard`
This commit is contained in:
parent
0011f4e7be
commit
dea2a6ed8d
|
@ -158,7 +158,7 @@ protected override void Update()
|
|||
}
|
||||
}
|
||||
|
||||
private void sort()
|
||||
protected virtual void sort()
|
||||
{
|
||||
if (sorting.IsValid)
|
||||
return;
|
||||
|
@ -174,10 +174,6 @@ private void sort()
|
|||
orderedByScore[i].ScorePosition = i + 1;
|
||||
}
|
||||
|
||||
// change displayed potision to '-' when there are 50 already submitted scores and tracked score is last
|
||||
if (TrackedScore?.ScorePosition == Flow.Count && Flow.Count == 51)
|
||||
TrackedScore.ScorePosition = null;
|
||||
|
||||
sorting.Validate();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
|
@ -16,6 +17,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||
public class SoloGameplayLeaderboard : GameplayLeaderboard
|
||||
{
|
||||
private const int duration = 100;
|
||||
private const int max_online_scores = 50; // BAD!
|
||||
|
||||
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
|
||||
private readonly IUser trackingUser;
|
||||
|
@ -42,10 +44,15 @@ public SoloGameplayLeaderboard(IUser trackingUser)
|
|||
this.trackingUser = trackingUser;
|
||||
}
|
||||
|
||||
private PlayBeatmapDetailArea.TabType scoresType;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
config.BindWith(OsuSetting.GameplayLeaderboard, configVisibility);
|
||||
|
||||
// a way to differentiate scores taken from online ranking to local scores
|
||||
scoresType = config.Get<PlayBeatmapDetailArea.TabType>(OsuSetting.BeatmapDetailTab);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -93,6 +100,18 @@ private void showScores()
|
|||
local.DisplayOrder.Value = long.MaxValue;
|
||||
}
|
||||
|
||||
protected override void sort()
|
||||
{
|
||||
base.sort();
|
||||
|
||||
if (scoresType != PlayBeatmapDetailArea.TabType.Local)
|
||||
{
|
||||
// change displayed potision to '-' when there are 50 already submitted scores and tracked score is last
|
||||
if (TrackedScore?.ScorePosition == Flow.Count && Flow.Count > max_online_scores)
|
||||
TrackedScore.ScorePosition = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVisibility() =>
|
||||
this.FadeTo(AlwaysVisible.Value || configVisibility.Value ? 1 : 0, duration);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue