1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:03:21 +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 string Category;
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 &= criteria.Locked || !r.Room.HasPassword.Value;
r.MatchingFilter = matchingFilter;
}
});

View File

@ -85,6 +85,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
private RoomsContainer roomsContainer;
private SearchTextBox searchTextBox;
private Dropdown<RoomStatusFilter> statusDropdown;
private Checkbox lockedCheckbox;
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] IdleTracker idleTracker)
@ -224,9 +225,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
{
SearchString = searchTextBox.Current.Value,
Ruleset = ruleset.Value,
Status = statusDropdown.Current.Value
Status = statusDropdown.Current.Value,
Locked = lockedCheckbox.Current.Value,
};
#endregion
protected virtual IEnumerable<Drawable> CreateFilterControls()
{
statusDropdown = new SlimEnumDropdown<RoomStatusFilter>
@ -237,10 +241,17 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
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)
{