diff --git a/osu.Game/Online/Spectator/SpectatorStreamingClient.cs b/osu.Game/Online/Spectator/SpectatorStreamingClient.cs index 5a41316f31..9e554d1d43 100644 --- a/osu.Game/Online/Spectator/SpectatorStreamingClient.cs +++ b/osu.Game/Online/Spectator/SpectatorStreamingClient.cs @@ -64,6 +64,16 @@ namespace osu.Game.Online.Spectator /// public event Action OnNewFrames; + /// + /// Called whenever a user starts a play session. + /// + public event Action OnUserBeganPlaying; + + /// + /// Called whenever a user starts a play session. + /// + public event Action OnUserFinishedPlaying; + [BackgroundDependencyLoader] private void load() { @@ -154,18 +164,24 @@ namespace osu.Game.Online.Spectator if (!playingUsers.Contains(userId)) playingUsers.Add(userId); + OnUserBeganPlaying?.Invoke(userId, state); + return Task.CompletedTask; } Task ISpectatorClient.UserFinishedPlaying(int userId, SpectatorState state) { playingUsers.Remove(userId); + + OnUserFinishedPlaying?.Invoke(userId, state); + return Task.CompletedTask; } Task ISpectatorClient.UserSentFrames(int userId, FrameDataBundle data) { OnNewFrames?.Invoke(userId, data); + return Task.CompletedTask; }