mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Refactor / cleanup debouncing
This commit is contained in:
@ -9,7 +9,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osuTK;
|
||||
@ -63,10 +62,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
filter?.BindValueChanged(f => scheduleFilter());
|
||||
|
||||
if (filter != null)
|
||||
Filter(filter.Value);
|
||||
filter?.BindValueChanged(f => Filter(f.NewValue), true);
|
||||
}
|
||||
|
||||
public void Filter(FilterCriteria criteria)
|
||||
@ -93,23 +89,13 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
});
|
||||
}
|
||||
|
||||
private ScheduledDelegate scheduledFilter;
|
||||
|
||||
private void scheduleFilter()
|
||||
{
|
||||
if (filter == null)
|
||||
return;
|
||||
|
||||
scheduledFilter?.Cancel();
|
||||
scheduledFilter = Scheduler.AddDelayed(() => Filter(filter.Value), 200);
|
||||
}
|
||||
|
||||
private void addRooms(IEnumerable<Room> rooms)
|
||||
{
|
||||
foreach (var r in rooms)
|
||||
roomFlow.Add(new DrawableRoom(r) { Action = () => selectRoom(r) });
|
||||
|
||||
filter?.TriggerChange();
|
||||
if (filter != null)
|
||||
Filter(filter.Value);
|
||||
}
|
||||
|
||||
private void removeRooms(IEnumerable<Room> rooms)
|
||||
|
Reference in New Issue
Block a user