Fix listing polling rate when entering room

This commit is contained in:
smoogipoo 2021-08-13 18:17:18 +09:00
parent 1bae7173d3
commit 1f992e67f3

View File

@ -184,7 +184,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
listingPollingComponent.HasPolledOnce.BindValueChanged(_ => updateLoadingLayer()); listingPollingComponent.HasPolledOnce.BindValueChanged(_ => updateLoadingLayer());
isIdle.BindValueChanged(_ => updatePollingRate(), true); isIdle.BindValueChanged(_ => updatePollingRate(this.IsCurrentScreen()), true);
if (ongoingOperationTracker != null) if (ongoingOperationTracker != null)
{ {
@ -272,13 +272,13 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
private void onReturning() private void onReturning()
{ {
updatePollingRate(); updatePollingRate(true);
searchTextBox.HoldFocus = true; searchTextBox.HoldFocus = true;
} }
private void onLeaving() private void onLeaving()
{ {
updatePollingRate(); updatePollingRate(false);
searchTextBox.HoldFocus = false; searchTextBox.HoldFocus = false;
// ensure any password prompt is dismissed. // ensure any password prompt is dismissed.
@ -332,9 +332,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
loadingLayer.Hide(); loadingLayer.Hide();
} }
private void updatePollingRate() private void updatePollingRate(bool isCurrentScreen)
{ {
if (!this.IsCurrentScreen()) if (!isCurrentScreen)
listingPollingComponent.TimeBetweenPolls.Value = 0; listingPollingComponent.TimeBetweenPolls.Value = 0;
else else
listingPollingComponent.TimeBetweenPolls.Value = isIdle.Value ? 120000 : 15000; listingPollingComponent.TimeBetweenPolls.Value = isIdle.Value ? 120000 : 15000;