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:
parent
dbe048cdc6
commit
11a7057289
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
15
osu.Game/Online/RealtimeMultiplayer/InvalidStateChange.cs
Normal file
15
osu.Game/Online/RealtimeMultiplayer/InvalidStateChange.cs
Normal 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}")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user