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:
parent
455a84c73f
commit
b9e4a7196e
@ -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,
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -61,5 +61,7 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
|
||||
}
|
||||
|
||||
protected override RoomManager CreateRoomManager() => new RealtimeRoomManager();
|
||||
|
||||
protected override LoungeSubScreen CreateLounge() => new RealtimeLoungeSubScreen();
|
||||
}
|
||||
}
|
||||
|
13
osu.Game/Screens/Multi/Timeshift/TimeshiftLoungeSubScreen.cs
Normal file
13
osu.Game/Screens/Multi/Timeshift/TimeshiftLoungeSubScreen.cs
Normal 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();
|
||||
}
|
||||
}
|
@ -45,5 +45,7 @@ namespace osu.Game.Screens.Multi.Timeshift
|
||||
}
|
||||
|
||||
protected override RoomManager CreateRoomManager() => new TimeshiftRoomManager();
|
||||
|
||||
protected override LoungeSubScreen CreateLounge() => new TimeshiftLoungeSubScreen();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user