1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-24 19:17:20 +08:00

Hide "show playing rooms" toggle when in filter mode it doesn't make sense with

This commit is contained in:
Bartłomiej Dach 2024-12-11 13:24:54 +09:00
parent 3352571f2a
commit b37a06c0fe
No known key found for this signature in database

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -48,7 +47,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
protected override IEnumerable<Drawable> CreateFilterControls()
{
roomAccessTypeDropdown = new SlimEnumDropdown<RoomPermissionsFilter>
foreach (var control in base.CreateFilterControls())
yield return control;
yield return roomAccessTypeDropdown = new SlimEnumDropdown<RoomPermissionsFilter>
{
RelativeSizeAxes = Axes.None,
Current = Config.GetBindable<RoomPermissionsFilter>(OsuSetting.MultiplayerRoomFilter),
@ -57,16 +59,17 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
roomAccessTypeDropdown.Current.BindValueChanged(_ => UpdateFilter());
showInProgress = new OsuCheckbox
yield return showInProgress = new OsuCheckbox
{
LabelText = "Show playing rooms",
RelativeSizeAxes = Axes.None,
Width = 200,
Padding = new MarginPadding { Vertical = 5, },
Current = { Value = true }
};
showInProgress.Current.BindValueChanged(_ => UpdateFilter());
return base.CreateFilterControls().Concat([roomAccessTypeDropdown, showInProgress]);
showInProgress.Current.BindValueChanged(_ => UpdateFilter());
StatusDropdown.Current.BindValueChanged(_ => showInProgress.Alpha = StatusDropdown.Current.Value == RoomModeFilter.Open ? 1 : 0, true);
}
protected override FilterCriteria CreateFilterCriteria()
@ -74,7 +77,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
var criteria = base.CreateFilterCriteria();
criteria.Category = @"realtime";
criteria.Permissions = roomAccessTypeDropdown.Current.Value;
criteria.Status = showInProgress.Current.Value ? null : RoomStatusFilter.Idle;
criteria.Status = showInProgress.Current.Value && criteria.Mode == RoomModeFilter.Open ? null : RoomStatusFilter.Idle;
return criteria;
}