mirror of
https://github.com/ppy/osu
synced 2024-12-23 23:33:36 +00:00
Add score processed callback to spectator client
This commit is contained in:
parent
d81a724dd7
commit
b03291330f
@ -32,5 +32,12 @@ namespace osu.Game.Online.Spectator
|
||||
/// <param name="userId">The user.</param>
|
||||
/// <param name="data">The frame data.</param>
|
||||
Task UserSentFrames(int userId, FrameDataBundle data);
|
||||
|
||||
/// <summary>
|
||||
/// Signals that a user's submitted score was fully processed.
|
||||
/// </summary>
|
||||
/// <param name="userId">The ID of the user who achieved the score.</param>
|
||||
/// <param name="scoreId">The ID of the score.</param>
|
||||
Task UserScoreProcessed(int userId, long scoreId);
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ namespace osu.Game.Online.Spectator
|
||||
connection.On<int, SpectatorState>(nameof(ISpectatorClient.UserBeganPlaying), ((ISpectatorClient)this).UserBeganPlaying);
|
||||
connection.On<int, FrameDataBundle>(nameof(ISpectatorClient.UserSentFrames), ((ISpectatorClient)this).UserSentFrames);
|
||||
connection.On<int, SpectatorState>(nameof(ISpectatorClient.UserFinishedPlaying), ((ISpectatorClient)this).UserFinishedPlaying);
|
||||
connection.On<int, long>(nameof(ISpectatorClient.UserScoreProcessed), ((ISpectatorClient)this).UserScoreProcessed);
|
||||
};
|
||||
|
||||
IsConnected.BindTo(connector.IsConnected);
|
||||
|
@ -64,6 +64,11 @@ namespace osu.Game.Online.Spectator
|
||||
/// </summary>
|
||||
public virtual event Action<int, SpectatorState>? OnUserFinishedPlaying;
|
||||
|
||||
/// <summary>
|
||||
/// Called whenever a user-submitted score has been fully processed.
|
||||
/// </summary>
|
||||
public virtual event Action<int, long>? OnUserScoreProcessed;
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary containing all users currently being watched, with the number of watching components for each user.
|
||||
/// </summary>
|
||||
@ -160,6 +165,13 @@ namespace osu.Game.Online.Spectator
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
Task ISpectatorClient.UserScoreProcessed(int userId, long scoreId)
|
||||
{
|
||||
Schedule(() => OnUserScoreProcessed?.Invoke(userId, scoreId));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void BeginPlaying(long? scoreToken, GameplayState state, Score score)
|
||||
{
|
||||
// This schedule is only here to match the one below in `EndPlaying`.
|
||||
|
Loading…
Reference in New Issue
Block a user