1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:12:57 +08:00

Add realtime lounge subscreen

This commit is contained in:
smoogipoo 2020-12-20 23:36:56 +09:00
parent 455a84c73f
commit b9e4a7196e
8 changed files with 66 additions and 15 deletions

View File

@ -10,10 +10,11 @@ using osu.Framework.Testing;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components;
using osu.Game.Screens.Multi.Timeshift;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneLoungeSubScreen : RoomManagerTestScene
public class TestSceneTimeshiftLoungeSubScreen : RoomManagerTestScene
{
private LoungeSubScreen loungeScreen;
@ -26,7 +27,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
base.SetUpSteps();
AddStep("push screen", () => LoadScreen(loungeScreen = new LoungeSubScreen
AddStep("push screen", () => LoadScreen(loungeScreen = new TimeshiftLoungeSubScreen
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -19,16 +19,15 @@ using osu.Game.Users;
namespace osu.Game.Screens.Multi.Lounge
{
[Cached]
public class LoungeSubScreen : MultiplayerSubScreen
public abstract class LoungeSubScreen : MultiplayerSubScreen
{
public override string Title => "Lounge";
protected FilterControl Filter;
protected override UserActivity InitialActivity => new UserActivity.SearchingForLobby();
private readonly IBindable<bool> initialRoomsReceived = new Bindable<bool>();
private FilterControl filter;
private Container content;
private LoadingLayer loadingLayer;
@ -78,11 +77,11 @@ namespace osu.Game.Screens.Multi.Lounge
},
},
},
Filter = new TimeshiftFilterControl
filter = CreateFilterControl().With(d =>
{
RelativeSizeAxes = Axes.X,
Height = 80,
},
d.RelativeSizeAxes = Axes.X;
d.Height = 80;
})
};
// scroll selected room into view on selection.
@ -108,7 +107,7 @@ namespace osu.Game.Screens.Multi.Lounge
content.Padding = new MarginPadding
{
Top = Filter.DrawHeight,
Top = filter.DrawHeight,
Left = WaveOverlayContainer.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + HORIZONTAL_OVERFLOW_PADDING,
Right = WaveOverlayContainer.WIDTH_PADDING + HORIZONTAL_OVERFLOW_PADDING,
};
@ -116,7 +115,7 @@ namespace osu.Game.Screens.Multi.Lounge
protected override void OnFocus(FocusEvent e)
{
Filter.TakeFocus();
filter.TakeFocus();
}
public override void OnEntering(IScreen last)
@ -140,19 +139,19 @@ namespace osu.Game.Screens.Multi.Lounge
private void onReturning()
{
Filter.HoldFocus = true;
filter.HoldFocus = true;
}
public override bool OnExiting(IScreen next)
{
Filter.HoldFocus = false;
filter.HoldFocus = false;
return base.OnExiting(next);
}
public override void OnSuspending(IScreen next)
{
base.OnSuspending(next);
Filter.HoldFocus = false;
filter.HoldFocus = false;
}
private void joinRequested(Room room)
@ -195,5 +194,7 @@ namespace osu.Game.Screens.Multi.Lounge
this.Push(new MatchSubScreen(room));
}
protected abstract FilterControl CreateFilterControl();
}
}

View File

@ -143,7 +143,7 @@ namespace osu.Game.Screens.Multi
screenStack.ScreenPushed += screenPushed;
screenStack.ScreenExited += screenExited;
screenStack.Push(loungeSubScreen = new LoungeSubScreen());
screenStack.Push(loungeSubScreen = CreateLounge());
}
private readonly IBindable<APIState> apiState = new Bindable<APIState>();
@ -361,6 +361,8 @@ namespace osu.Game.Screens.Multi
protected abstract RoomManager CreateRoomManager();
protected abstract LoungeSubScreen CreateLounge();
private class MultiplayerWaveContainer : WaveContainer
{
protected override bool StartHidden => true;

View File

@ -0,0 +1,17 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Screens.Multi.Lounge.Components;
namespace osu.Game.Screens.Multi.RealtimeMultiplayer
{
public class RealtimeFilterControl : FilterControl
{
protected override FilterCriteria CreateCriteria()
{
var criteria = base.CreateCriteria();
criteria.Category = "realtime";
return criteria;
}
}
}

View File

@ -0,0 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components;
namespace osu.Game.Screens.Multi.RealtimeMultiplayer
{
public class RealtimeLoungeSubScreen : LoungeSubScreen
{
protected override FilterControl CreateFilterControl() => new RealtimeFilterControl();
}
}

View File

@ -61,5 +61,7 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
}
protected override RoomManager CreateRoomManager() => new RealtimeRoomManager();
protected override LoungeSubScreen CreateLounge() => new RealtimeLoungeSubScreen();
}
}

View File

@ -0,0 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components;
namespace osu.Game.Screens.Multi.Timeshift
{
public class TimeshiftLoungeSubScreen : LoungeSubScreen
{
protected override FilterControl CreateFilterControl() => new TimeshiftFilterControl();
}
}

View File

@ -45,5 +45,7 @@ namespace osu.Game.Screens.Multi.Timeshift
}
protected override RoomManager CreateRoomManager() => new TimeshiftRoomManager();
protected override LoungeSubScreen CreateLounge() => new TimeshiftLoungeSubScreen();
}
}