mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 01:07:23 +08:00
LoungePollingComponent
-> LoungeListingPoller
This commit is contained in:
parent
f3e9d1931c
commit
0696cfa4f2
@ -805,7 +805,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddUntilStep("wait for room", () => this.ChildrenOfType<DrawableRoom>().Any());
|
AddUntilStep("wait for room", () => this.ChildrenOfType<DrawableRoom>().Any());
|
||||||
AddStep("select room", () => InputManager.Key(Key.Down));
|
AddStep("select room", () => InputManager.Key(Key.Down));
|
||||||
|
|
||||||
AddStep("disable polling", () => this.ChildrenOfType<LoungePollingComponent>().Single().TimeBetweenPolls.Value = 0);
|
AddStep("disable polling", () => this.ChildrenOfType<LoungeListingPoller>().Single().TimeBetweenPolls.Value = 0);
|
||||||
AddStep("change server-side settings", () =>
|
AddStep("change server-side settings", () =>
|
||||||
{
|
{
|
||||||
multiplayerClient.ServerSideRooms[0].Name = "New name";
|
multiplayerClient.ServerSideRooms[0].Name = "New name";
|
||||||
|
@ -14,9 +14,9 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
|||||||
namespace osu.Game.Screens.OnlinePlay.Lounge
|
namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <see cref="PollingComponent"/> that polls for the lounge listing.
|
/// Polls for rooms for the main lounge listing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class LoungePollingComponent : PollingComponent
|
public partial class LoungeListingPoller : PollingComponent
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
@ -75,7 +75,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
private readonly IBindable<bool> operationInProgress = new Bindable<bool>();
|
private readonly IBindable<bool> operationInProgress = new Bindable<bool>();
|
||||||
private readonly IBindable<bool> isIdle = new BindableBool();
|
private readonly IBindable<bool> isIdle = new BindableBool();
|
||||||
private RoomsContainer roomsContainer = null!;
|
private RoomsContainer roomsContainer = null!;
|
||||||
private LoungePollingComponent pollingComponent = null!;
|
private LoungeListingPoller listingPoller = null!;
|
||||||
private PopoverContainer popoverContainer = null!;
|
private PopoverContainer popoverContainer = null!;
|
||||||
private LoadingLayer loadingLayer = null!;
|
private LoadingLayer loadingLayer = null!;
|
||||||
private SearchTextBox searchTextBox = null!;
|
private SearchTextBox searchTextBox = null!;
|
||||||
@ -92,7 +92,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
pollingComponent = new LoungePollingComponent
|
listingPoller = new LoungeListingPoller
|
||||||
{
|
{
|
||||||
RoomsReceived = onListingReceived,
|
RoomsReceived = onListingReceived,
|
||||||
Filter = { BindTarget = filter }
|
Filter = { BindTarget = filter }
|
||||||
@ -187,7 +187,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
{
|
{
|
||||||
roomsContainer.Rooms.Clear();
|
roomsContainer.Rooms.Clear();
|
||||||
hasListingResults.Value = false;
|
hasListingResults.Value = false;
|
||||||
pollingComponent.PollImmediately();
|
listingPoller.PollImmediately();
|
||||||
});
|
});
|
||||||
|
|
||||||
updateFilter();
|
updateFilter();
|
||||||
@ -268,7 +268,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
onReturning();
|
onReturning();
|
||||||
|
|
||||||
// Poll for any newly-created rooms (including potentially the user's own).
|
// Poll for any newly-created rooms (including potentially the user's own).
|
||||||
pollingComponent.PollImmediately();
|
listingPoller.PollImmediately();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(ScreenExitEvent e)
|
public override bool OnExiting(ScreenExitEvent e)
|
||||||
@ -379,7 +379,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
|
|
||||||
protected virtual void OpenNewRoom(Room room) => this.Push(CreateRoomSubScreen(room));
|
protected virtual void OpenNewRoom(Room room) => this.Push(CreateRoomSubScreen(room));
|
||||||
|
|
||||||
public void RefreshRooms() => pollingComponent.PollImmediately();
|
public void RefreshRooms() => listingPoller.PollImmediately();
|
||||||
|
|
||||||
private void updateLoadingLayer()
|
private void updateLoadingLayer()
|
||||||
{
|
{
|
||||||
@ -392,11 +392,11 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
private void updatePollingRate(bool isCurrentScreen)
|
private void updatePollingRate(bool isCurrentScreen)
|
||||||
{
|
{
|
||||||
if (!isCurrentScreen)
|
if (!isCurrentScreen)
|
||||||
pollingComponent.TimeBetweenPolls.Value = 0;
|
listingPoller.TimeBetweenPolls.Value = 0;
|
||||||
else
|
else
|
||||||
pollingComponent.TimeBetweenPolls.Value = isIdle.Value ? 120000 : 15000;
|
listingPoller.TimeBetweenPolls.Value = isIdle.Value ? 120000 : 15000;
|
||||||
|
|
||||||
Logger.Log($"Polling adjusted (listing: {pollingComponent.TimeBetweenPolls.Value})");
|
Logger.Log($"Polling adjusted (listing: {listingPoller.TimeBetweenPolls.Value})");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract OsuButton CreateNewRoomButton();
|
protected abstract OsuButton CreateNewRoomButton();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user