2020-12-20 22:32:57 +08:00
|
|
|
// 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.
|
|
|
|
|
2021-12-14 10:30:42 +08:00
|
|
|
using System.Diagnostics;
|
2020-12-20 22:32:57 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Screens;
|
|
|
|
using osu.Game.Online.Multiplayer;
|
2020-12-25 23:50:00 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Components;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge;
|
2020-12-20 22:32:57 +08:00
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
2020-12-20 22:32:57 +08:00
|
|
|
{
|
2020-12-26 00:00:00 +08:00
|
|
|
public class Multiplayer : OnlinePlayScreen
|
2020-12-20 22:32:57 +08:00
|
|
|
{
|
|
|
|
[Resolved]
|
2021-05-20 14:39:45 +08:00
|
|
|
private MultiplayerClient client { get; set; }
|
2020-12-20 22:32:57 +08:00
|
|
|
|
|
|
|
public override void OnResuming(IScreen last)
|
|
|
|
{
|
|
|
|
base.OnResuming(last);
|
|
|
|
|
2021-12-14 10:30:42 +08:00
|
|
|
if (client.Room == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Debug.Assert(client.LocalUser != null);
|
|
|
|
|
|
|
|
switch (client.LocalUser.State)
|
|
|
|
{
|
|
|
|
case MultiplayerUserState.Spectating:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MultiplayerUserState.WaitingForLoad:
|
2021-12-14 15:52:57 +08:00
|
|
|
case MultiplayerUserState.Loaded:
|
|
|
|
case MultiplayerUserState.Playing:
|
|
|
|
client.AbortGameplay();
|
2021-12-14 10:30:42 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
client.ChangeState(MultiplayerUserState.Idle);
|
|
|
|
break;
|
|
|
|
}
|
2020-12-20 22:32:57 +08:00
|
|
|
}
|
|
|
|
|
2020-12-24 23:18:35 +08:00
|
|
|
protected override string ScreenTitle => "Multiplayer";
|
|
|
|
|
2020-12-25 12:38:11 +08:00
|
|
|
protected override RoomManager CreateRoomManager() => new MultiplayerRoomManager();
|
2020-12-20 22:36:56 +08:00
|
|
|
|
2020-12-25 12:38:11 +08:00
|
|
|
protected override LoungeSubScreen CreateLounge() => new MultiplayerLoungeSubScreen();
|
2020-12-20 22:32:57 +08:00
|
|
|
}
|
|
|
|
}
|