mirror of
https://github.com/ppy/osu.git
synced 2026-05-19 01:49:53 +08:00
Merge pull request #32373 from smoogipoo/mp-filter-freestyle
Filter freestyle rooms against all rulesets
This commit is contained in:
@@ -11,6 +11,7 @@ using osu.Framework.Testing;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets.Catch;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
using osu.Game.Tests.Visual.OnlinePlay;
|
||||
@@ -198,6 +199,22 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddStep("add rooms", () => rooms.AddRange(GenerateRooms(3, withPassword: true)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFreestyleBypassesRulesetFilter()
|
||||
{
|
||||
AddStep("apply taiko filter", () => container.Filter.Value = new FilterCriteria { Ruleset = new TaikoRuleset().RulesetInfo });
|
||||
|
||||
AddStep("add osu + freestyle room", () =>
|
||||
{
|
||||
var room = GenerateRooms(1, new OsuRuleset().RulesetInfo)[0];
|
||||
room.Playlist[0].Freestyle = true;
|
||||
room.CurrentPlaylistItem = room.Playlist[0];
|
||||
rooms.Add(room);
|
||||
});
|
||||
|
||||
AddAssert("room visible", () => container.DrawableRooms.Any());
|
||||
}
|
||||
|
||||
private bool checkRoomSelected(Room? room) => selectedRoom.Value == room;
|
||||
|
||||
private Room? getRoomInFlow(int index) =>
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
bool matchingFilter = true;
|
||||
|
||||
matchingFilter &= criteria.Ruleset == null || r.Room.PlaylistItemStats?.RulesetIDs.Any(id => id == criteria.Ruleset.OnlineID) != false;
|
||||
matchingFilter &= criteria.Ruleset == null || r.Room.CurrentPlaylistItem?.Freestyle == true || r.Room.PlaylistItemStats?.RulesetIDs.Any(id => id == criteria.Ruleset.OnlineID) != false;
|
||||
matchingFilter &= matchPermissions(r, criteria.Permissions);
|
||||
|
||||
// Room name isn't translatable, so ToString() is used here for simplicity.
|
||||
|
||||
Reference in New Issue
Block a user