mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Move filter to LoungeSubScreen
This commit is contained in:
@ -18,8 +18,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
public IBindable<bool> InitialRoomsReceived => initialRoomsReceived;
|
||||
private readonly Bindable<bool> initialRoomsReceived = new Bindable<bool>();
|
||||
|
||||
[Resolved]
|
||||
private Bindable<FilterCriteria> currentFilter { get; set; }
|
||||
public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>();
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Room> selectedRoom { get; set; }
|
||||
@ -27,7 +26,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
currentFilter.BindValueChanged(_ =>
|
||||
Filter.BindValueChanged(_ =>
|
||||
{
|
||||
RoomManager.ClearRooms();
|
||||
initialRoomsReceived.Value = false;
|
||||
@ -44,10 +43,13 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
if (!API.IsLoggedIn)
|
||||
return base.Poll();
|
||||
|
||||
if (Filter.Value == null)
|
||||
return base.Poll();
|
||||
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
|
||||
pollReq?.Cancel();
|
||||
pollReq = new GetRoomsRequest(currentFilter.Value.Status, currentFilter.Value.Category);
|
||||
pollReq = new GetRoomsRequest(Filter.Value.Status, Filter.Value.Category);
|
||||
|
||||
pollReq.Success += result =>
|
||||
{
|
||||
|
@ -30,8 +30,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
|
||||
public IReadOnlyList<DrawableRoom> Rooms => roomFlow.FlowingChildren.Cast<DrawableRoom>().ToArray();
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private Bindable<FilterCriteria> filter { get; set; }
|
||||
public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>();
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Room> selectedRoom { get; set; }
|
||||
@ -74,7 +73,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
|
||||
rooms.BindTo(roomManager.Rooms);
|
||||
|
||||
filter?.BindValueChanged(criteria => Filter(criteria.NewValue));
|
||||
Filter?.BindValueChanged(criteria => applyFilterCriteria(criteria.NewValue), true);
|
||||
|
||||
selectedRoom.BindValueChanged(selection =>
|
||||
{
|
||||
@ -85,7 +84,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
private void updateSelection() =>
|
||||
roomFlow.Children.ForEach(r => r.State = r.Room == selectedRoom.Value ? SelectionState.Selected : SelectionState.NotSelected);
|
||||
|
||||
public void Filter(FilterCriteria criteria)
|
||||
private void applyFilterCriteria(FilterCriteria criteria)
|
||||
{
|
||||
roomFlow.Children.ForEach(r =>
|
||||
{
|
||||
@ -126,7 +125,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
roomFlow.Add(new DrawableRoom(room));
|
||||
}
|
||||
|
||||
Filter(filter?.Value);
|
||||
applyFilterCriteria(Filter?.Value);
|
||||
|
||||
updateSelection();
|
||||
}
|
||||
|
@ -56,9 +56,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OngoingOperationTracker ongoingOperationTracker { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private Bindable<FilterCriteria> filter { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||
|
||||
@ -68,6 +65,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
[CanBeNull]
|
||||
private LeasedBindable<Room> selectionLease;
|
||||
|
||||
private readonly Bindable<FilterCriteria> filter = new Bindable<FilterCriteria>(new FilterCriteria());
|
||||
private readonly IBindable<bool> operationInProgress = new Bindable<bool>();
|
||||
private readonly IBindable<bool> isIdle = new BindableBool();
|
||||
private LoadingLayer loadingLayer;
|
||||
@ -81,13 +79,11 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
if (idleTracker != null)
|
||||
isIdle.BindTo(idleTracker.IsIdle);
|
||||
|
||||
filter ??= new Bindable<FilterCriteria>(new FilterCriteria());
|
||||
|
||||
OsuScrollContainer scrollContainer;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
ListingPollingComponent = CreatePollingComponent(),
|
||||
ListingPollingComponent = CreatePollingComponent().With(c => c.Filter.BindTarget = filter),
|
||||
loadingLayer = new LoadingLayer(true),
|
||||
new Container
|
||||
{
|
||||
@ -161,7 +157,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarOverlapsContent = false,
|
||||
Child = roomsContainer = new RoomsContainer()
|
||||
Child = roomsContainer = new RoomsContainer
|
||||
{
|
||||
Filter = { BindTarget = filter }
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -202,7 +201,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
|
||||
#region Filtering
|
||||
|
||||
protected void UpdateFilter() => Scheduler.AddOnce(updateFilter);
|
||||
public void UpdateFilter() => Scheduler.AddOnce(updateFilter);
|
||||
|
||||
private ScheduledDelegate scheduledFilterUpdate;
|
||||
|
||||
|
@ -20,7 +20,6 @@ using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -49,9 +48,6 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
[Cached]
|
||||
private readonly Bindable<Room> selectedRoom = new Bindable<Room>();
|
||||
|
||||
[Cached]
|
||||
private readonly Bindable<FilterCriteria> currentFilter = new Bindable<FilterCriteria>(new FilterCriteria());
|
||||
|
||||
[Cached]
|
||||
private readonly OngoingOperationTracker ongoingOperationTracker = new OngoingOperationTracker();
|
||||
|
||||
|
Reference in New Issue
Block a user