2020-10-22 10:41:10 +00: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.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2020-10-21 10:05:20 +00:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace osu.Game.Online.Spectator
|
|
|
|
{
|
2020-10-22 04:12:58 +00:00
|
|
|
/// <summary>
|
|
|
|
/// An interface defining the spectator server instance.
|
|
|
|
/// </summary>
|
2020-10-21 10:05:20 +00:00
|
|
|
public interface ISpectatorServer
|
|
|
|
{
|
2020-10-22 04:12:58 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Signal the start of a new play session.
|
|
|
|
/// </summary>
|
2022-12-12 04:59:27 +00:00
|
|
|
/// <param name="scoreToken">The score submission token.</param>
|
2020-10-22 08:29:38 +00:00
|
|
|
/// <param name="state">The state of gameplay.</param>
|
2022-12-12 04:59:27 +00:00
|
|
|
Task BeginPlaySession(long? scoreToken, SpectatorState state);
|
2020-10-22 04:12:58 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Send a bundle of frame data for the current play session.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The frame data.</param>
|
2020-10-21 10:05:20 +00:00
|
|
|
Task SendFrameData(FrameDataBundle data);
|
2020-10-22 04:12:58 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Signal the end of a play session.
|
|
|
|
/// </summary>
|
2020-10-22 08:29:38 +00:00
|
|
|
/// <param name="state">The state of gameplay.</param>
|
|
|
|
Task EndPlaySession(SpectatorState state);
|
2020-10-21 10:05:20 +00:00
|
|
|
|
2020-10-22 04:12:58 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Request spectating data for the specified user. May be called on multiple users and offline users.
|
|
|
|
/// For offline users, a subscription will be created and data will begin streaming on next play.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="userId">The user to subscribe to.</param>
|
2020-10-22 09:37:19 +00:00
|
|
|
Task StartWatchingUser(int userId);
|
2020-10-22 04:12:58 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Stop requesting spectating data for the specified user. Unsubscribes from receiving further data.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="userId">The user to unsubscribe from.</param>
|
2020-10-22 09:37:19 +00:00
|
|
|
Task EndWatchingUser(int userId);
|
2020-10-21 10:05:20 +00:00
|
|
|
}
|
|
|
|
}
|