1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 08:02:54 +08:00
osu-lazer/osu.Game/Screens/OnlinePlay/IRoomManager.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
2.4 KiB
C#
Raw Normal View History

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