2022-07-04 17:18:33 +09: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-07-14 15:18:12 +09:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2022-07-04 17:18:33 +09:00
|
|
|
using System.Threading.Tasks;
|
2023-12-06 18:24:31 +01:00
|
|
|
using osu.Framework.Bindables;
|
2022-07-04 17:18:33 +09:00
|
|
|
using osu.Framework.Graphics;
|
2023-12-06 18:24:31 +01:00
|
|
|
using osu.Game.Users;
|
2022-07-04 17:18:33 +09:00
|
|
|
|
|
|
|
namespace osu.Game.Online.Metadata
|
|
|
|
{
|
2022-11-24 14:32:20 +09:00
|
|
|
public abstract partial class MetadataClient : Component, IMetadataClient, IMetadataServer
|
2022-07-04 17:18:33 +09:00
|
|
|
{
|
2023-12-06 18:24:31 +01:00
|
|
|
public abstract IBindable<bool> IsConnected { get; }
|
|
|
|
|
|
|
|
#region Beatmap metadata updates
|
2022-07-04 17:18:33 +09:00
|
|
|
|
2022-07-05 21:42:35 +09:00
|
|
|
public abstract Task<BeatmapUpdates> GetChangesSince(int queueId);
|
2022-07-14 15:18:12 +09:00
|
|
|
|
2023-12-06 18:24:31 +01:00
|
|
|
public abstract Task BeatmapSetsUpdated(BeatmapUpdates updates);
|
|
|
|
|
|
|
|
public event Action<int[]>? ChangedBeatmapSetsArrived;
|
2022-07-14 15:18:12 +09:00
|
|
|
|
|
|
|
protected Task ProcessChanges(int[] beatmapSetIDs)
|
|
|
|
{
|
|
|
|
ChangedBeatmapSetsArrived?.Invoke(beatmapSetIDs.Distinct().ToArray());
|
|
|
|
return Task.CompletedTask;
|
|
|
|
}
|
2023-12-06 18:24:31 +01:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region User presence updates
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Whether the client is currently receiving user presence updates from the server.
|
|
|
|
/// </summary>
|
|
|
|
public abstract IBindable<bool> IsWatchingUserPresence { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Dictionary keyed by user ID containing all of the <see cref="UserPresence"/> information about currently online users received from the server.
|
|
|
|
/// </summary>
|
|
|
|
public abstract IBindableDictionary<int, UserPresence> UserStates { get; }
|
|
|
|
|
2025-01-09 17:31:01 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Dictionary keyed by user ID containing all of the <see cref="UserPresence"/> information about currently online friends received from the server.
|
|
|
|
/// </summary>
|
|
|
|
public abstract IBindableDictionary<int, UserPresence> FriendStates { get; }
|
|
|
|
|
2023-12-06 18:24:31 +01:00
|
|
|
/// <inheritdoc/>
|
|
|
|
public abstract Task UpdateActivity(UserActivity? activity);
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public abstract Task UpdateStatus(UserStatus? status);
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public abstract Task BeginWatchingUserPresence();
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public abstract Task EndWatchingUserPresence();
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public abstract Task UserPresenceUpdated(int userId, UserPresence? presence);
|
|
|
|
|
2025-01-09 17:31:01 +09:00
|
|
|
/// <inheritdoc/>
|
|
|
|
public abstract Task FriendPresenceUpdated(int userId, UserPresence? presence);
|
|
|
|
|
2023-12-06 18:24:31 +01:00
|
|
|
#endregion
|
|
|
|
|
2024-05-17 10:32:39 +02:00
|
|
|
#region Daily Challenge
|
|
|
|
|
|
|
|
public abstract IBindable<DailyChallengeInfo?> DailyChallengeInfo { get; }
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public abstract Task DailyChallengeUpdated(DailyChallengeInfo? info);
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2024-06-27 10:44:28 +02:00
|
|
|
#region Multiplayer room watching
|
|
|
|
|
|
|
|
public abstract Task<MultiplayerPlaylistItemStats[]> BeginWatchingMultiplayerRoom(long id);
|
|
|
|
|
|
|
|
public abstract Task EndWatchingMultiplayerRoom(long id);
|
|
|
|
|
|
|
|
public event Action<MultiplayerRoomScoreSetEvent>? MultiplayerRoomScoreSet;
|
|
|
|
|
|
|
|
Task IMetadataClient.MultiplayerRoomScoreSet(MultiplayerRoomScoreSetEvent roomScoreSetEvent)
|
|
|
|
{
|
|
|
|
if (MultiplayerRoomScoreSet != null)
|
|
|
|
Schedule(MultiplayerRoomScoreSet, roomScoreSetEvent);
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2023-12-06 18:24:31 +01:00
|
|
|
#region Disconnection handling
|
|
|
|
|
|
|
|
public event Action? Disconnecting;
|
|
|
|
|
|
|
|
public virtual Task DisconnectRequested()
|
|
|
|
{
|
|
|
|
Schedule(() => Disconnecting?.Invoke());
|
|
|
|
return Task.CompletedTask;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2022-07-04 17:18:33 +09:00
|
|
|
}
|
|
|
|
}
|