mirror of https://github.com/ppy/osu
Tidy up initialisation code and avoid using DI on inherited class
This commit is contained in:
parent
2b6caf9b65
commit
dbb8f7f4a9
|
@ -577,15 +577,15 @@ protected override void LoadComplete()
|
|||
|
||||
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
|
||||
|
|
|
@ -61,6 +61,8 @@ public class OsuGameBase : Framework.Game, ICanAcceptFiles
|
|||
|
||||
protected OsuConfigManager LocalConfig;
|
||||
|
||||
protected SessionStatics SessionStatics { get; private set; }
|
||||
|
||||
protected BeatmapManager BeatmapManager;
|
||||
|
||||
protected ScoreManager ScoreManager;
|
||||
|
@ -289,7 +291,7 @@ List<ScoreInfo> getBeatmapScores(BeatmapSetInfo set)
|
|||
if (powerStatus != null)
|
||||
dependencies.CacheAs(powerStatus);
|
||||
|
||||
dependencies.Cache(new SessionStatics());
|
||||
dependencies.Cache(SessionStatics = new SessionStatics());
|
||||
dependencies.Cache(new OsuColour());
|
||||
|
||||
RegisterImportHandler(BeatmapManager);
|
||||
|
|
Loading…
Reference in New Issue