mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 08:22:56 +08:00
Inject IdleTracker into ButtonSystem
This commit is contained in:
parent
3c0b77658c
commit
c7b3fa51d5
@ -85,7 +85,6 @@ namespace osu.Game
|
||||
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
||||
|
||||
private IdleTracker idleTracker;
|
||||
public double IdleTime => idleTracker?.IdleTime ?? 0;
|
||||
|
||||
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||
|
||||
@ -378,6 +377,7 @@ namespace osu.Game
|
||||
Depth = -6,
|
||||
}, overlayContent.Add);
|
||||
|
||||
dependencies.Cache(idleTracker);
|
||||
dependencies.Cache(settings);
|
||||
dependencies.Cache(onscreenDisplay);
|
||||
dependencies.Cache(social);
|
||||
|
@ -64,6 +64,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private SampleChannel sampleBack;
|
||||
|
||||
private IdleTracker idleTracker;
|
||||
|
||||
public ButtonSystem()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
@ -102,9 +104,10 @@ namespace osu.Game.Screens.Menu
|
||||
private OsuGame game;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio, OsuGame game)
|
||||
private void load(AudioManager audio, OsuGame game, IdleTracker idleTracker)
|
||||
{
|
||||
this.game = game;
|
||||
this.idleTracker = idleTracker;
|
||||
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
||||
}
|
||||
|
||||
@ -266,7 +269,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
if (game?.IdleTime > 6000 && State != ButtonSystemState.Exit)
|
||||
if (idleTracker.IdleTime > 6000 && State != ButtonSystemState.Exit)
|
||||
State = ButtonSystemState.Initial;
|
||||
|
||||
base.Update();
|
||||
|
Loading…
Reference in New Issue
Block a user