1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Tidy up initialisation code and avoid using DI on inherited class

This commit is contained in:
Dean Herbert 2021-04-19 11:30:55 +09:00
parent 2b6caf9b65
commit dbb8f7f4a9
2 changed files with 9 additions and 7 deletions

View File

@ -577,15 +577,15 @@ namespace osu.Game
dependencies.CacheAs(idleTracker = new GameIdleTracker(6000));
GameIdleTracker sessionIdleTracker = new GameIdleTracker(300_000);
Add(sessionIdleTracker);
sessionIdleTracker.IsIdle.BindValueChanged(e =>
var sessionIdleTracker = new GameIdleTracker(300000);
sessionIdleTracker.IsIdle.BindValueChanged(idle =>
{
if (e.NewValue)
Dependencies.Get<SessionStatics>().ResetValues();
if (idle.NewValue)
SessionStatics.ResetValues();
});
Add(new GameIdleTracker(300000));
AddRange(new Drawable[]
{
new VolumeControlReceptor

View File

@ -61,6 +61,8 @@ namespace osu.Game
protected OsuConfigManager LocalConfig;
protected SessionStatics SessionStatics { get; private set; }
protected BeatmapManager BeatmapManager;
protected ScoreManager ScoreManager;
@ -289,7 +291,7 @@ namespace osu.Game
if (powerStatus != null)
dependencies.CacheAs(powerStatus);
dependencies.Cache(new SessionStatics());
dependencies.Cache(SessionStatics = new SessionStatics());
dependencies.Cache(new OsuColour());
RegisterImportHandler(BeatmapManager);