1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 09:37:23 +08:00

Tidy up bindable flow

This commit is contained in:
Dean Herbert 2022-11-18 15:50:41 +09:00
parent e4f522aad1
commit 20af8217f4

View File

@ -20,6 +20,9 @@ namespace osu.Game.Screens.Play.HUD
private const int duration = 100; private const int duration = 100;
private readonly Bindable<bool> configVisibility = new Bindable<bool>(); private readonly Bindable<bool> configVisibility = new Bindable<bool>();
private readonly Bindable<PlayBeatmapDetailArea.TabType> scoreSource = new Bindable<PlayBeatmapDetailArea.TabType>();
private readonly IUser trackingUser; private readonly IUser trackingUser;
public readonly IBindableList<ScoreInfo> Scores = new BindableList<ScoreInfo>(); public readonly IBindableList<ScoreInfo> Scores = new BindableList<ScoreInfo>();
@ -39,8 +42,6 @@ namespace osu.Game.Screens.Play.HUD
/// </summary> /// </summary>
public readonly Bindable<bool> AlwaysVisible = new Bindable<bool>(true); public readonly Bindable<bool> AlwaysVisible = new Bindable<bool>(true);
private Bindable<PlayBeatmapDetailArea.TabType> scoresType = new Bindable<PlayBeatmapDetailArea.TabType>();
public SoloGameplayLeaderboard(IUser trackingUser) public SoloGameplayLeaderboard(IUser trackingUser)
{ {
this.trackingUser = trackingUser; this.trackingUser = trackingUser;
@ -50,14 +51,13 @@ namespace osu.Game.Screens.Play.HUD
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
config.BindWith(OsuSetting.GameplayLeaderboard, configVisibility); config.BindWith(OsuSetting.GameplayLeaderboard, configVisibility);
config.BindWith(OsuSetting.BeatmapDetailTab, scoreSource);
// a way to differentiate scores taken from online ranking to local scores
scoresType = config.GetBindable<PlayBeatmapDetailArea.TabType>(OsuSetting.BeatmapDetailTab);
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
Scores.BindCollectionChanged((_, _) => Scheduler.AddOnce(showScores), true); Scores.BindCollectionChanged((_, _) => Scheduler.AddOnce(showScores), true);
// Alpha will be updated via `updateVisibility` below. // Alpha will be updated via `updateVisibility` below.
@ -104,9 +104,9 @@ namespace osu.Game.Screens.Play.HUD
{ {
base.Sort(); base.Sort();
if (scoresType.Value != PlayBeatmapDetailArea.TabType.Local) // change displayed position to '-' when there are 50 already submitted scores and tracked score is last
if (scoreSource.Value != PlayBeatmapDetailArea.TabType.Local)
{ {
// change displayed position to '-' when there are 50 already submitted scores and tracked score is last
if (TrackedScore?.ScorePosition == Flow.Count && Flow.Count > GetScoresRequest.MAX_SCORES_PER_REQUEST) if (TrackedScore?.ScorePosition == Flow.Count && Flow.Count > GetScoresRequest.MAX_SCORES_PER_REQUEST)
TrackedScore.ScorePosition = null; TrackedScore.ScorePosition = null;
} }