mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Add ruleset to multiplayer filter criteria
This commit is contained in:
@ -7,6 +7,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays.SearchableList;
|
using osu.Game.Overlays.SearchableList;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Multi.Lounge.Components
|
namespace osu.Game.Screens.Multi.Lounge.Components
|
||||||
@ -22,6 +23,9 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private Bindable<FilterCriteria> filter { get; set; }
|
private Bindable<FilterCriteria> filter { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
|
||||||
public FilterControl()
|
public FilterControl()
|
||||||
{
|
{
|
||||||
DisplayStyleControl.Hide();
|
DisplayStyleControl.Hide();
|
||||||
@ -38,6 +42,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
ruleset.BindValueChanged(_ => updateFilter());
|
||||||
Search.Current.BindValueChanged(_ => scheduleUpdateFilter());
|
Search.Current.BindValueChanged(_ => scheduleUpdateFilter());
|
||||||
Tabs.Current.BindValueChanged(_ => updateFilter(), true);
|
Tabs.Current.BindValueChanged(_ => updateFilter(), true);
|
||||||
}
|
}
|
||||||
@ -58,7 +63,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
{
|
{
|
||||||
SearchString = Search.Current.Value ?? string.Empty,
|
SearchString = Search.Current.Value ?? string.Empty,
|
||||||
PrimaryFilter = Tabs.Current.Value,
|
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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Multi.Lounge.Components
|
namespace osu.Game.Screens.Multi.Lounge.Components
|
||||||
{
|
{
|
||||||
public class FilterCriteria
|
public class FilterCriteria
|
||||||
@ -8,5 +10,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
public string SearchString;
|
public string SearchString;
|
||||||
public PrimaryFilter PrimaryFilter;
|
public PrimaryFilter PrimaryFilter;
|
||||||
public SecondaryFilter SecondaryFilter;
|
public SecondaryFilter SecondaryFilter;
|
||||||
|
public RulesetInfo Ruleset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,9 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool matchingFilter = true;
|
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);
|
matchingFilter &= r.FilterTerms.Any(term => term.IndexOf(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
||||||
|
|
||||||
switch (criteria.SecondaryFilter)
|
switch (criteria.SecondaryFilter)
|
||||||
|
Reference in New Issue
Block a user