1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 13:33:03 +08:00

add locked room filter

This commit is contained in:
Gabe Livengood 2022-06-22 17:01:28 -04:00
parent 97fcf8cec9
commit bf5a7e3f2a
No known key found for this signature in database
GPG Key ID: 70321B78DAECE683
3 changed files with 18 additions and 4 deletions

View File

@ -13,5 +13,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
public RoomStatusFilter Status; public RoomStatusFilter Status;
public string Category; public string Category;
public RulesetInfo Ruleset; public RulesetInfo Ruleset;
public bool Locked = true;
} }
} }

View File

@ -87,6 +87,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase));
} }
matchingFilter &= criteria.Locked || !r.Room.HasPassword.Value;
r.MatchingFilter = matchingFilter; r.MatchingFilter = matchingFilter;
} }
}); });

View File

@ -85,6 +85,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
private RoomsContainer roomsContainer; private RoomsContainer roomsContainer;
private SearchTextBox searchTextBox; private SearchTextBox searchTextBox;
private Dropdown<RoomStatusFilter> statusDropdown; private Dropdown<RoomStatusFilter> statusDropdown;
private Checkbox lockedCheckbox;
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load([CanBeNull] IdleTracker idleTracker) private void load([CanBeNull] IdleTracker idleTracker)
@ -224,9 +225,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
{ {
SearchString = searchTextBox.Current.Value, SearchString = searchTextBox.Current.Value,
Ruleset = ruleset.Value, Ruleset = ruleset.Value,
Status = statusDropdown.Current.Value Status = statusDropdown.Current.Value,
Locked = lockedCheckbox.Current.Value,
}; };
#endregion
protected virtual IEnumerable<Drawable> CreateFilterControls() protected virtual IEnumerable<Drawable> CreateFilterControls()
{ {
statusDropdown = new SlimEnumDropdown<RoomStatusFilter> statusDropdown = new SlimEnumDropdown<RoomStatusFilter>
@ -237,10 +241,17 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
statusDropdown.Current.BindValueChanged(_ => UpdateFilter()); statusDropdown.Current.BindValueChanged(_ => UpdateFilter());
yield return statusDropdown; lockedCheckbox = new OsuTabControlCheckbox
} {
Current = new Bindable<bool>(true),
RelativeSizeAxes = Axes.None,
Text = @"Show Locked",
};
#endregion lockedCheckbox.Current.BindValueChanged(_ => UpdateFilter());
return new Drawable[] { lockedCheckbox, statusDropdown, };
}
public override void OnEntering(ScreenTransitionEvent e) public override void OnEntering(ScreenTransitionEvent e)
{ {