Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions osu.Game/Online/Multiplayer/MatchServerEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace osu.Game.Online.Multiplayer
[Union(1, typeof(CountdownStoppedEvent))]
[Union(2, typeof(MatchmakingAvatarActionEvent))]
[Union(3, typeof(RankedPlayCardHandReplayEvent))]
[Union(4, typeof(RollEvent))]
public abstract class MatchServerEvent
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class TeamVersusRoomState : MatchRoomState
[Key(0)]
public List<MultiplayerTeam> Teams { get; set; } = new List<MultiplayerTeam>();

[Key(1)]
public bool Locked { get; set; }

public static TeamVersusRoomState CreateDefault() =>
new TeamVersusRoomState
{
Expand Down
2 changes: 2 additions & 0 deletions osu.Game/Online/Multiplayer/MatchUserRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ namespace osu.Game.Online.Multiplayer
[Union(2, typeof(StopCountdownRequest))]
[Union(3, typeof(MatchmakingAvatarActionRequest))]
[Union(4, typeof(RankedPlayCardHandReplayRequest))]
[Union(5, typeof(SetLockStateRequest))]
[Union(6, typeof(RollRequest))]
public abstract class MatchUserRequest
{
}
Expand Down
36 changes: 36 additions & 0 deletions osu.Game/Online/Multiplayer/RollEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 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;
using MessagePack;

namespace osu.Game.Online.Multiplayer
{
/// <summary>
/// Communicates the result of a <see cref="RollRequest"/>.
/// </summary>
[Serializable]
[MessagePackObject]
public class RollEvent : MatchServerEvent
{
/// <summary>
/// The ID of the user who initiated the roll.
/// </summary>
[Key(0)]
public int UserID { get; set; }

/// <summary>
/// Determines the maximum possible result of the roll.
/// Bigger than 1.
/// </summary>
[Key(1)]
public uint Max { get; set; }

/// <summary>
/// The actual result of the roll.
/// In the range [1, <see cref="Max"/>], inclusive both ends.
/// </summary>
[Key(2)]
public uint Result { get; set; }
}
}
24 changes: 24 additions & 0 deletions osu.Game/Online/Multiplayer/RollRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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;
using MessagePack;

namespace osu.Game.Online.Multiplayer
{
/// <summary>
/// Requests a random roll of a number from 1 to <see cref="Max"/> inclusive.
/// </summary>
[Serializable]
[MessagePackObject]
public class RollRequest : MatchUserRequest
{
/// <summary>
/// Determines the maximum possible result of the roll.
/// Must be bigger than 1.
/// Defaults to 100 if not provided.
/// </summary>
[Key(0)]
public uint? Max { get; set; }
}
}
24 changes: 24 additions & 0 deletions osu.Game/Online/Multiplayer/SetLockStateRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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 MessagePack;

namespace osu.Game.Online.Multiplayer
{
[MessagePackObject]
public class SetLockStateRequest : MatchUserRequest
{
/// <summary>
/// <para>
/// If <see langword="true"/>, <see cref="MultiplayerRoomUserRole.Player"/>s will not be able to change teams by themselves in the room,
/// only <see cref="MultiplayerRoomUserRole.Referee"/>s will be able to change teams for the <see cref="MultiplayerRoomUserRole.Player"/>s.
/// </para>
/// <para>
/// If <see langword="false"/>, any user can change their team in the room.
/// </para>
/// </summary>
// TODO: mention slots as well when slots are reimplemented
[Key(0)]
public bool Locked { get; set; }
}
}
3 changes: 3 additions & 0 deletions osu.Game/Online/SignalRWorkaroundTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ internal static class SignalRWorkaroundTypes
(typeof(ChangeTeamRequest), typeof(MatchUserRequest)),
(typeof(StartMatchCountdownRequest), typeof(MatchUserRequest)),
(typeof(StopCountdownRequest), typeof(MatchUserRequest)),
(typeof(SetLockStateRequest), typeof(MatchUserRequest)),
(typeof(RollRequest), typeof(MatchUserRequest)),
(typeof(CountdownStartedEvent), typeof(MatchServerEvent)),
(typeof(CountdownStoppedEvent), typeof(MatchServerEvent)),
(typeof(RollEvent), typeof(MatchServerEvent)),
(typeof(TeamVersusRoomState), typeof(MatchRoomState)),
(typeof(TeamVersusUserState), typeof(MatchUserState)),
(typeof(MatchStartCountdown), typeof(MultiplayerCountdown)),
Expand Down
Loading