mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 19:27:31 +08:00
Add flow for sending match ruleset specific messages to the server
This commit is contained in:
parent
e8338f2711
commit
9d1e95caf0
@ -55,6 +55,12 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// <param name="newMods">The proposed new mods, excluding any required by the room itself.</param>
|
/// <param name="newMods">The proposed new mods, excluding any required by the room itself.</param>
|
||||||
Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send a match ruleset specific request.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The request to send.</param>
|
||||||
|
Task SendMatchRulesetRequest(MatchRulesetUserRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// As the host of a room, start the match.
|
/// As the host of a room, start the match.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
17
osu.Game/Online/Multiplayer/MatchRulesetUserRequest.cs
Normal file
17
osu.Game/Online/Multiplayer/MatchRulesetUserRequest.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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>
|
||||||
|
/// A request from a user to perform an action specific to the current match ruleset.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
[MessagePackObject]
|
||||||
|
public abstract class MatchRulesetUserRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
// 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.MatchRulesets.TeamVs
|
||||||
|
{
|
||||||
|
public class ChangeTeamRequest : MatchRulesetUserRequest
|
||||||
|
{
|
||||||
|
[Key(0)]
|
||||||
|
public int TeamID { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -293,6 +293,8 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
|
|
||||||
public abstract Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
public abstract Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||||
|
|
||||||
|
public abstract Task SendMatchRulesetRequest(MatchRulesetUserRequest request);
|
||||||
|
|
||||||
public abstract Task StartMatch();
|
public abstract Task StartMatch();
|
||||||
|
|
||||||
Task IMultiplayerClient.RoomStateChanged(MultiplayerRoomState state)
|
Task IMultiplayerClient.RoomStateChanged(MultiplayerRoomState state)
|
||||||
|
@ -118,6 +118,14 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
return connection.InvokeAsync(nameof(IMultiplayerServer.ChangeUserMods), newMods);
|
return connection.InvokeAsync(nameof(IMultiplayerServer.ChangeUserMods), newMods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task SendMatchRulesetRequest(MatchRulesetUserRequest request)
|
||||||
|
{
|
||||||
|
if (!IsConnected.Value)
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
return connection.InvokeAsync(nameof(IMultiplayerServer.SendMatchRulesetRequest), request);
|
||||||
|
}
|
||||||
|
|
||||||
public override Task StartMatch()
|
public override Task StartMatch()
|
||||||
{
|
{
|
||||||
if (!IsConnected.Value)
|
if (!IsConnected.Value)
|
||||||
|
@ -192,6 +192,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task SendMatchRulesetRequest(MatchRulesetUserRequest request) => Task.CompletedTask;
|
||||||
|
|
||||||
public override Task StartMatch()
|
public override Task StartMatch()
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
Debug.Assert(Room != null);
|
||||||
|
Loading…
Reference in New Issue
Block a user