Split timeshift & multiplayer "create" buttons

Multiplayer button gets new, different "Create match" text, and disable
logic in case of a dropped connection to the multiplayer server.
This commit is contained in:
Bartłomiej Dach 2020-12-23 22:02:37 +01:00
parent c13acb609a
commit 414f886b02
5 changed files with 41 additions and 10 deletions

View File

@ -128,18 +128,18 @@ protected Multiplayer()
}
},
new Header(screenStack),
createButton = new CreateRoomButton
createButton = CreateNewMultiplayerGameButton().With(button =>
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Size = new Vector2(150, Header.HEIGHT - 20),
Margin = new MarginPadding
button.Anchor = Anchor.TopRight;
button.Origin = Anchor.TopRight;
button.Size = new Vector2(150, Header.HEIGHT - 20);
button.Margin = new MarginPadding
{
Top = 10,
Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
},
Action = () => OpenNewRoom()
},
};
button.Action = () => OpenNewRoom();
}),
RoomManager = CreateRoomManager()
}
};
@ -315,6 +315,8 @@ private void subScreenChanged(IScreen lastScreen, IScreen newScreen)
protected abstract LoungeSubScreen CreateLounge();
protected abstract OsuButton CreateNewMultiplayerGameButton();
private class MultiplayerWaveContainer : WaveContainer
{
protected override bool StartHidden => true;

View File

@ -0,0 +1,23 @@
// 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.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Online.RealtimeMultiplayer;
using osu.Game.Screens.Multi.Match.Components;
namespace osu.Game.Screens.Multi.RealtimeMultiplayer
{
public class CreateRealtimeMatchButton : PurpleTriangleButton
{
[BackgroundDependencyLoader]
private void load(StatefulMultiplayerClient multiplayerClient)
{
Triangles.TriangleScale = 1.5f;
Text = "Create match";
((IBindable<bool>)Enabled).BindTo(multiplayerClient.IsConnected);
}
}
}

View File

@ -5,6 +5,7 @@
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Extensions;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.RealtimeMultiplayer;
using osu.Game.Screens.Multi.Components;
@ -64,5 +65,7 @@ protected override Room CreateNewRoom()
protected override RoomManager CreateRoomManager() => new RealtimeRoomManager();
protected override LoungeSubScreen CreateLounge() => new RealtimeLoungeSubScreen();
protected override OsuButton CreateNewMultiplayerGameButton() => new CreateRealtimeMatchButton();
}
}

View File

@ -4,9 +4,9 @@
using osu.Framework.Allocation;
using osu.Game.Screens.Multi.Match.Components;
namespace osu.Game.Screens.Multi
namespace osu.Game.Screens.Multi.Timeshift
{
public class CreateRoomButton : PurpleTriangleButton
public class CreateTimeshiftRoomButton : PurpleTriangleButton
{
[BackgroundDependencyLoader]
private void load()

View File

@ -3,6 +3,7 @@
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Multi.Components;
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Match;
@ -47,5 +48,7 @@ protected override void UpdatePollingRate(bool isIdle)
protected override RoomManager CreateRoomManager() => new TimeshiftRoomManager();
protected override LoungeSubScreen CreateLounge() => new TimeshiftLoungeSubScreen();
protected override OsuButton CreateNewMultiplayerGameButton() => new CreateTimeshiftRoomButton();
}
}