1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 03:52:54 +08:00

Remove type conversion from LoungeTab to RoomAvailability

This commit is contained in:
smoogipoo 2018-12-03 17:50:39 +09:00
parent 8f1d53400e
commit 51c16867d5
3 changed files with 28 additions and 4 deletions

View File

@ -1,14 +1,24 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Game.Screens.Multi; using osu.Game.Screens.Multi;
using osu.Game.Screens.Multi.Screens.Lounge;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[TestFixture] [TestFixture]
public class TestCaseMultiScreen : OsuTestCase public class TestCaseMultiScreen : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(Multiplayer),
typeof(Lounge),
typeof(FilterControl)
};
public TestCaseMultiScreen() public TestCaseMultiScreen()
{ {
Multiplayer multi = new Multiplayer(); Multiplayer multi = new Multiplayer();

View File

@ -17,11 +17,26 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
{ {
DisplayStyleControl.Hide(); DisplayStyleControl.Hide();
} }
public RoomAvailability Availability
{
get
{
switch (Tabs.Current.Value)
{
default:
case LoungeTab.Public:
return RoomAvailability.Public;
case LoungeTab.Private:
return RoomAvailability.FriendsOnly;
}
}
}
} }
public enum LoungeTab public enum LoungeTab
{ {
Public = RoomAvailability.Public, Public,
Private = RoomAvailability.FriendsOnly, Private,
} }
} }

View File

@ -147,8 +147,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
foreach (DrawableRoom r in RoomsContainer.Children) foreach (DrawableRoom r in RoomsContainer.Children)
{ {
r.MatchingFilter = r.MatchingFilter && r.MatchingFilter = r.MatchingFilter && r.Room.Availability.Value == Filter.Availability;
r.Room.Availability.Value == (RoomAvailability)Filter.Tabs.Current.Value;
} }
} }