1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 22:22:55 +08:00

Merge pull request #11206 from smoogipoo/realtime-room-composite

This commit is contained in:
Bartłomiej Dach 2020-12-20 18:19:30 +01:00 committed by GitHub
commit 6cca0bc6ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,38 @@
// 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;
using osu.Game.Online.RealtimeMultiplayer;
namespace osu.Game.Screens.Multi.RealtimeMultiplayer
{
public abstract class RealtimeRoomComposite : MultiplayerComposite
{
[CanBeNull]
protected MultiplayerRoom Room => Client.Room;
[Resolved]
protected StatefulMultiplayerClient Client { get; private set; }
protected override void LoadComplete()
{
base.LoadComplete();
Client.RoomChanged += OnRoomChanged;
OnRoomChanged();
}
protected virtual void OnRoomChanged()
{
}
protected override void Dispose(bool isDisposing)
{
if (Client != null)
Client.RoomChanged -= OnRoomChanged;
base.Dispose(isDisposing);
}
}
}