mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
move config
This commit is contained in:
parent
4295d9c169
commit
5d18001d75
@ -5,6 +5,8 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -13,6 +15,9 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
public class SoloGameplayLeaderboard : GameplayLeaderboard
|
public class SoloGameplayLeaderboard : GameplayLeaderboard
|
||||||
{
|
{
|
||||||
|
private const int duration = 100;
|
||||||
|
|
||||||
|
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
|
||||||
private readonly IUser trackingUser;
|
private readonly IUser trackingUser;
|
||||||
|
|
||||||
public readonly IBindableList<ScoreInfo> Scores = new BindableList<ScoreInfo>();
|
public readonly IBindableList<ScoreInfo> Scores = new BindableList<ScoreInfo>();
|
||||||
@ -31,10 +36,18 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
this.trackingUser = trackingUser;
|
this.trackingUser = trackingUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
config.BindWith(OsuSetting.GameplayLeaderboard, configVisibility);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
Scores.BindCollectionChanged((_, _) => Scheduler.AddOnce(showScores), true);
|
Scores.BindCollectionChanged((_, _) => Scheduler.AddOnce(showScores), true);
|
||||||
|
|
||||||
|
configVisibility.BindValueChanged(_ => updateVisibility(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showScores()
|
private void showScores()
|
||||||
@ -69,5 +82,8 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
// Local score should always show lower than any existing scores in cases of ties.
|
// Local score should always show lower than any existing scores in cases of ties.
|
||||||
local.DisplayOrder.Value = long.MaxValue;
|
local.DisplayOrder.Value = long.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateVisibility() =>
|
||||||
|
Flow.FadeTo(configVisibility.Value ? 1 : 0, duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user