2019-01-24 17:43:03 +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.
|
2018-12-25 11:45:50 +09:00
|
|
|
|
|
|
|
using System;
|
2020-12-19 00:15:41 +09:00
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 19:04:31 +09:00
|
|
|
using osu.Framework.Bindables;
|
2020-12-25 13:38:11 +09:00
|
|
|
using osu.Game.Online.Rooms;
|
2018-12-25 11:45:50 +09:00
|
|
|
|
2020-12-25 16:50:00 +01:00
|
|
|
namespace osu.Game.Screens.OnlinePlay
|
2018-12-25 11:45:50 +09:00
|
|
|
{
|
2020-12-19 00:15:41 +09:00
|
|
|
[Cached(typeof(IRoomManager))]
|
2018-12-25 11:45:50 +09:00
|
|
|
public interface IRoomManager
|
|
|
|
{
|
2018-12-28 01:45:19 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Invoked when the <see cref="Room"/>s have been updated.
|
|
|
|
/// </summary>
|
|
|
|
event Action RoomsUpdated;
|
|
|
|
|
2018-12-25 11:45:50 +09:00
|
|
|
/// <summary>
|
|
|
|
/// All the active <see cref="Room"/>s.
|
|
|
|
/// </summary>
|
2019-01-07 18:50:27 +09:00
|
|
|
IBindableList<Room> Rooms { get; }
|
2018-12-25 11:45:50 +09:00
|
|
|
|
2021-08-13 22:08:34 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Adds a <see cref="Room"/> to this <see cref="IRoomManager"/>.
|
|
|
|
/// If already existing, the local room will be updated with the given one.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="room">The incoming <see cref="Room"/>.</param>
|
2021-08-13 17:39:09 +09:00
|
|
|
void AddOrUpdateRoom(Room room);
|
|
|
|
|
2021-08-13 22:08:34 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Removes a <see cref="Room"/> from this <see cref="IRoomManager"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="room">The <see cref="Room"/> to remove.</param>
|
2021-08-13 17:39:09 +09:00
|
|
|
void RemoveRoom(Room room);
|
|
|
|
|
2021-08-13 22:08:34 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Removes all <see cref="Room"/>s from this <see cref="IRoomManager"/>.
|
|
|
|
/// </summary>
|
2021-08-13 17:39:09 +09:00
|
|
|
void ClearRooms();
|
|
|
|
|
2018-12-25 11:45:50 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new <see cref="Room"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="room">The <see cref="Room"/> to create.</param>
|
2018-12-26 20:45:56 +09:00
|
|
|
/// <param name="onSuccess">An action to be invoked if the creation succeeds.</param>
|
2018-12-26 18:38:58 +09:00
|
|
|
/// <param name="onError">An action to be invoked if an error occurred.</param>
|
2021-07-10 16:08:12 +09:00
|
|
|
void CreateRoom(Room room, Action<Room>? onSuccess = null, Action<string>? onError = null);
|
2018-12-25 11:45:50 +09:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Joins a <see cref="Room"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="room">The <see cref="Room"/> to join. <see cref="Room.RoomID"/> must be populated.</param>
|
2021-07-10 16:08:12 +09:00
|
|
|
/// <param name="password">An optional password to use for the join operation.</param>
|
2018-12-26 21:10:31 +09:00
|
|
|
/// <param name="onSuccess"></param>
|
|
|
|
/// <param name="onError"></param>
|
2021-07-10 16:08:12 +09:00
|
|
|
void JoinRoom(Room room, string? password = null, Action<Room>? onSuccess = null, Action<string>? onError = null);
|
2018-12-25 11:45:50 +09:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Parts the currently-joined <see cref="Room"/>.
|
|
|
|
/// </summary>
|
|
|
|
void PartRoom();
|
|
|
|
}
|
|
|
|
}
|