mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 08:13:31 +08:00
Slight cleanup in multiplayer
This commit is contained in:
parent
43240ea85e
commit
99a7ccc01a
@ -49,6 +49,8 @@ namespace osu.Game.Screens.Multi
|
||||
private readonly LoungeSubScreen loungeSubScreen;
|
||||
private readonly ScreenStack screenStack;
|
||||
|
||||
private readonly IBindable<bool> isIdle = new BindableBool();
|
||||
|
||||
[Cached]
|
||||
private readonly Bindable<Room> currentRoom = new Bindable<Room>();
|
||||
|
||||
@ -137,8 +139,6 @@ namespace osu.Game.Screens.Multi
|
||||
screenStack.ScreenExited += screenExited;
|
||||
}
|
||||
|
||||
private readonly IBindable<bool> isIdle = new BindableBool();
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(IdleTracker idleTracker)
|
||||
{
|
||||
@ -148,6 +148,12 @@ namespace osu.Game.Screens.Multi
|
||||
isIdle.BindTo(idleTracker.IsIdle);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
isIdle.BindValueChanged(updatePollingRate, true);
|
||||
}
|
||||
|
||||
private CachedModelDependencyContainer<Room> dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
@ -157,12 +163,6 @@ namespace osu.Game.Screens.Multi
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
isIdle.BindValueChanged(updatePollingRate, true);
|
||||
}
|
||||
|
||||
private void updatePollingRate(bool idle)
|
||||
{
|
||||
roomManager.TimeBetweenPolls = !this.IsCurrentScreen() || !(screenStack.CurrentScreen is LoungeSubScreen) ? 0 : (idle ? 120000 : 15000);
|
||||
|
Loading…
Reference in New Issue
Block a user