mirror of
https://github.com/ppy/osu.git
synced 2025-03-22 21:00:33 +08:00
Add ruleset to multiplayer filter criteria
This commit is contained in:
parent
7f0a134bc8
commit
50c4e34c92
@ -7,6 +7,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.SearchableList;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
@ -22,6 +23,9 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
[Resolved(CanBeNull = true)]
|
||||
private Bindable<FilterCriteria> filter { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||
|
||||
public FilterControl()
|
||||
{
|
||||
DisplayStyleControl.Hide();
|
||||
@ -38,6 +42,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ruleset.BindValueChanged(_ => updateFilter());
|
||||
Search.Current.BindValueChanged(_ => scheduleUpdateFilter());
|
||||
Tabs.Current.BindValueChanged(_ => updateFilter(), true);
|
||||
}
|
||||
@ -58,7 +63,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
{
|
||||
SearchString = Search.Current.Value ?? string.Empty,
|
||||
PrimaryFilter = Tabs.Current.Value,
|
||||
SecondaryFilter = DisplayStyleControl.Dropdown.Current.Value
|
||||
SecondaryFilter = DisplayStyleControl.Dropdown.Current.Value,
|
||||
Ruleset = ruleset.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
{
|
||||
public class FilterCriteria
|
||||
@ -8,5 +10,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
public string SearchString;
|
||||
public PrimaryFilter PrimaryFilter;
|
||||
public SecondaryFilter SecondaryFilter;
|
||||
public RulesetInfo Ruleset;
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
else
|
||||
{
|
||||
bool matchingFilter = true;
|
||||
|
||||
matchingFilter &= r.Room.Playlist.Any(i => i.Ruleset.Equals(criteria.Ruleset));
|
||||
|
||||
matchingFilter &= r.FilterTerms.Any(term => term.IndexOf(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
||||
|
||||
switch (criteria.SecondaryFilter)
|
||||
|
Loading…
x
Reference in New Issue
Block a user