diff --git a/osu.Game/Online/Multiplayer/MatchServerEvent.cs b/osu.Game/Online/Multiplayer/MatchServerEvent.cs index 402de392a84c..723452d3f63b 100644 --- a/osu.Game/Online/Multiplayer/MatchServerEvent.cs +++ b/osu.Game/Online/Multiplayer/MatchServerEvent.cs @@ -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 { } diff --git a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs index 375842964395..d5e30bb2e08b 100644 --- a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs +++ b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs @@ -12,6 +12,9 @@ public class TeamVersusRoomState : MatchRoomState [Key(0)] public List Teams { get; set; } = new List(); + [Key(1)] + public bool Locked { get; set; } + public static TeamVersusRoomState CreateDefault() => new TeamVersusRoomState { diff --git a/osu.Game/Online/Multiplayer/MatchUserRequest.cs b/osu.Game/Online/Multiplayer/MatchUserRequest.cs index fdcbf756822f..bacc1a7632b4 100644 --- a/osu.Game/Online/Multiplayer/MatchUserRequest.cs +++ b/osu.Game/Online/Multiplayer/MatchUserRequest.cs @@ -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 { } diff --git a/osu.Game/Online/Multiplayer/RollEvent.cs b/osu.Game/Online/Multiplayer/RollEvent.cs new file mode 100644 index 000000000000..8588bc6adf1a --- /dev/null +++ b/osu.Game/Online/Multiplayer/RollEvent.cs @@ -0,0 +1,36 @@ +// Copyright (c) ppy Pty Ltd . 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 +{ + /// + /// Communicates the result of a . + /// + [Serializable] + [MessagePackObject] + public class RollEvent : MatchServerEvent + { + /// + /// The ID of the user who initiated the roll. + /// + [Key(0)] + public int UserID { get; set; } + + /// + /// Determines the maximum possible result of the roll. + /// Bigger than 1. + /// + [Key(1)] + public uint Max { get; set; } + + /// + /// The actual result of the roll. + /// In the range [1, ], inclusive both ends. + /// + [Key(2)] + public uint Result { get; set; } + } +} diff --git a/osu.Game/Online/Multiplayer/RollRequest.cs b/osu.Game/Online/Multiplayer/RollRequest.cs new file mode 100644 index 000000000000..3f6be23e1e87 --- /dev/null +++ b/osu.Game/Online/Multiplayer/RollRequest.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . 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 +{ + /// + /// Requests a random roll of a number from 1 to inclusive. + /// + [Serializable] + [MessagePackObject] + public class RollRequest : MatchUserRequest + { + /// + /// Determines the maximum possible result of the roll. + /// Must be bigger than 1. + /// Defaults to 100 if not provided. + /// + [Key(0)] + public uint? Max { get; set; } + } +} diff --git a/osu.Game/Online/Multiplayer/SetLockStateRequest.cs b/osu.Game/Online/Multiplayer/SetLockStateRequest.cs new file mode 100644 index 000000000000..8f1451fdab7a --- /dev/null +++ b/osu.Game/Online/Multiplayer/SetLockStateRequest.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . 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 + { + /// + /// + /// If , s will not be able to change teams by themselves in the room, + /// only s will be able to change teams for the s. + /// + /// + /// If , any user can change their team in the room. + /// + /// + // TODO: mention slots as well when slots are reimplemented + [Key(0)] + public bool Locked { get; set; } + } +} diff --git a/osu.Game/Online/SignalRWorkaroundTypes.cs b/osu.Game/Online/SignalRWorkaroundTypes.cs index 70c6fcf2b780..06e8451205b2 100644 --- a/osu.Game/Online/SignalRWorkaroundTypes.cs +++ b/osu.Game/Online/SignalRWorkaroundTypes.cs @@ -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)),