mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Directly resolve the filter bindable
This commit is contained in:
parent
990bd44ca2
commit
7f13e3c5f7
@ -130,8 +130,6 @@ namespace osu.Game.Screens.Multi
|
||||
roomManager = new RoomManager()
|
||||
});
|
||||
|
||||
roomManager.Filter.BindTo(filter);
|
||||
|
||||
screenStack.ScreenPushed += screenPushed;
|
||||
screenStack.ScreenExited += screenExited;
|
||||
}
|
||||
|
@ -24,15 +24,13 @@ namespace osu.Game.Screens.Multi
|
||||
private readonly BindableList<Room> rooms = new BindableList<Room>();
|
||||
public IBindableList<Room> Rooms => rooms;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="FilterCriteria"/> to use when polling for <see cref="Room"/>s.
|
||||
/// </summary>
|
||||
public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>();
|
||||
|
||||
public Bindable<Room> CurrentRoom { get; } = new Bindable<Room>();
|
||||
|
||||
private Room joinedRoom;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<FilterCriteria> filter { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private APIAccess api { get; set; }
|
||||
|
||||
@ -44,14 +42,13 @@ namespace osu.Game.Screens.Multi
|
||||
|
||||
public RoomManager()
|
||||
{
|
||||
Filter.BindValueChanged(_ =>
|
||||
filter.BindValueChanged(_ =>
|
||||
{
|
||||
if (IsLoaded)
|
||||
PollImmediately();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
@ -137,7 +134,7 @@ namespace osu.Game.Screens.Multi
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
|
||||
pollReq?.Cancel();
|
||||
pollReq = new GetRoomsRequest(Filter.Value.PrimaryFilter);
|
||||
pollReq = new GetRoomsRequest(filter.Value.PrimaryFilter);
|
||||
|
||||
pollReq.Success += result =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user