1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 02:57:25 +08:00

Add notification flow for user state changes in room

This commit is contained in:
Dean Herbert 2020-12-08 17:41:56 +09:00
parent dbe048cdc6
commit 11a7057289
3 changed files with 29 additions and 0 deletions

View File

@ -30,5 +30,12 @@ namespace osu.Game.Online.RealtimeMultiplayer
/// </summary>
/// <param name="settings">The new settings to apply.</param>
Task ChangeSettings(MultiplayerRoomSettings settings);
/// <summary>
/// Change the local user state in the currently joined room.
/// </summary>
/// <param name="newState">The proposed new state.</param>
/// <exception cref="InvalidStateChange">If the state change requested is not valid, given the previous state or room state.</exception>
Task ChangeState(MultiplayerUserState newState);
}
}

View File

@ -39,5 +39,12 @@ namespace osu.Game.Online.RealtimeMultiplayer
/// </summary>
/// <param name="newSettings">The updated room settings.</param>
Task SettingsChanged(MultiplayerRoomSettings newSettings);
/// <summary>
/// Signals that a user in this room changed their state.
/// </summary>
/// <param name="userId">The ID of the user performing a state change.</param>
/// <param name="state">The new state of the user.</param>
Task UserStateChanged(long userId, MultiplayerUserState state);
}
}

View File

@ -0,0 +1,15 @@
// 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;
namespace osu.Game.Online.RealtimeMultiplayer
{
public class InvalidStateChange : Exception
{
public InvalidStateChange(MultiplayerUserState oldState, MultiplayerUserState newState)
: base($"Cannot change from {oldState} to {newState}")
{
}
}
}