2020-12-19 01:30:53 +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.
|
|
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
using osu.Framework.Allocation;
|
2020-12-25 12:38:11 +08:00
|
|
|
using osu.Game.Online.Multiplayer;
|
2020-12-19 01:30:53 +08:00
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
2020-12-19 01:30:53 +08:00
|
|
|
{
|
2020-12-26 00:12:33 +08:00
|
|
|
public abstract class MultiplayerRoomComposite : OnlinePlayComposite
|
2020-12-19 01:30:53 +08:00
|
|
|
{
|
|
|
|
[CanBeNull]
|
|
|
|
protected MultiplayerRoom Room => Client.Room;
|
|
|
|
|
|
|
|
[Resolved]
|
2021-05-20 14:39:45 +08:00
|
|
|
protected MultiplayerClient Client { get; private set; }
|
2020-12-19 01:30:53 +08:00
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2020-12-26 09:48:55 +08:00
|
|
|
Client.RoomUpdated += OnRoomUpdated;
|
|
|
|
OnRoomUpdated();
|
2020-12-19 01:30:53 +08:00
|
|
|
}
|
|
|
|
|
2020-12-26 09:48:55 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Invoked when any change occurs to the multiplayer room.
|
|
|
|
/// </summary>
|
|
|
|
protected virtual void OnRoomUpdated()
|
2020-12-19 01:30:53 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
{
|
|
|
|
if (Client != null)
|
2020-12-26 09:48:55 +08:00
|
|
|
Client.RoomUpdated -= OnRoomUpdated;
|
2020-12-19 01:30:53 +08:00
|
|
|
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|