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