Drop MatchRuleset terminology completely

This commit is contained in:
Dean Herbert
2021-08-03 15:43:04 +09:00
parent 66427127f0
commit 70da58323a
16 changed files with 47 additions and 45 deletions

View File

@ -51,23 +51,23 @@ namespace osu.Game.Online.Multiplayer
Task UserStateChanged(int userId, MultiplayerUserState state); Task UserStateChanged(int userId, MultiplayerUserState state);
/// <summary> /// <summary>
/// Signals that the match ruleset state has changed for a user in this room. /// Signals that the match type state has changed for a user in this room.
/// </summary> /// </summary>
/// <param name="userId">The ID of the user performing a state change.</param> /// <param name="userId">The ID of the user performing a state change.</param>
/// <param name="state">The new state of the user.</param> /// <param name="state">The new state of the user.</param>
Task MatchRulesetUserStateChanged(int userId, MatchRulesetUserState state); Task MatchUserStateChanged(int userId, MatchUserState state);
/// <summary> /// <summary>
/// Signals that the match ruleset state has changed for this room. /// Signals that the match type state has changed for this room.
/// </summary> /// </summary>
/// <param name="state">The new state of the room.</param> /// <param name="state">The new state of the room.</param>
Task MatchRulesetRoomStateChanged(MatchRulesetRoomState state); Task MatchRoomStateChanged(MatchRoomState state);
/// <summary> /// <summary>
/// Send a match ruleset specific request. /// Send a match type specific request.
/// </summary> /// </summary>
/// <param name="e">The event to handle.</param> /// <param name="e">The event to handle.</param>
Task MatchRulesetEvent(MatchRulesetServerEvent e); Task MatchEvent(MatchServerEvent e);
/// <summary> /// <summary>
/// Signals that a user in this room changed their beatmap availability state. /// Signals that a user in this room changed their beatmap availability state.

View File

@ -56,10 +56,10 @@ namespace osu.Game.Online.Multiplayer
Task ChangeUserMods(IEnumerable<APIMod> newMods); Task ChangeUserMods(IEnumerable<APIMod> newMods);
/// <summary> /// <summary>
/// Send a match ruleset specific request. /// Send a match type specific request.
/// </summary> /// </summary>
/// <param name="request">The request to send.</param> /// <param name="request">The request to send.</param>
Task SendMatchRulesetRequest(MatchRulesetUserRequest request); Task SendMatchRequest(MatchUserRequest request);
/// <summary> /// <summary>
/// As the host of a room, start the match. /// As the host of a room, start the match.

View File

@ -3,20 +3,21 @@
using System; using System;
using MessagePack; using MessagePack;
using osu.Game.Online.Multiplayer.MatchRulesets.TeamVs; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
#nullable enable #nullable enable
namespace osu.Game.Online.Multiplayer namespace osu.Game.Online.Multiplayer
{ {
/// <summary> /// <summary>
/// Room-wide state for the current match ruleset. /// Room-wide state for the current match type.
/// Can be used to contain any state which should be used before or during match gameplay. /// Can be used to contain any state which should be used before or during match gameplay.
/// </summary> /// </summary>
[Serializable] [Serializable]
[MessagePackObject] [MessagePackObject]
[Union(0, typeof(TeamVsMatchRoomState))] [Union(0, typeof(TeamVersusRoomState))]
public class MatchRulesetRoomState // TODO: this will need to be abstract or interface when/if we get messagepack working. for now it isn't as it breaks json serialisation. // TODO: this will need to be abstract or interface when/if we get messagepack working. for now it isn't as it breaks json serialisation.
public class MatchRoomState
{ {
} }
} }

View File

@ -11,7 +11,7 @@ namespace osu.Game.Online.Multiplayer
/// </summary> /// </summary>
[Serializable] [Serializable]
[MessagePackObject] [MessagePackObject]
public abstract class MatchRulesetServerEvent public abstract class MatchServerEvent
{ {
} }
} }

View File

@ -5,9 +5,9 @@ using MessagePack;
#nullable enable #nullable enable
namespace osu.Game.Online.Multiplayer.MatchRulesets.TeamVs namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
{ {
public class ChangeTeamRequest : MatchRulesetUserRequest public class ChangeTeamRequest : MatchUserRequest
{ {
[Key(0)] [Key(0)]
public int TeamID { get; set; } public int TeamID { get; set; }

View File

@ -6,7 +6,7 @@ using MessagePack;
#nullable enable #nullable enable
namespace osu.Game.Online.Multiplayer.MatchRulesets.TeamVs namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
{ {
[Serializable] [Serializable]
[MessagePackObject] [MessagePackObject]

View File

@ -6,16 +6,16 @@ using MessagePack;
#nullable enable #nullable enable
namespace osu.Game.Online.Multiplayer.MatchRulesets.TeamVs namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
{ {
[MessagePackObject] [MessagePackObject]
public class TeamVsMatchRoomState : MatchRulesetRoomState public class TeamVersusRoomState : MatchRoomState
{ {
[Key(0)] [Key(0)]
public List<MultiplayerTeam> Teams { get; set; } = new List<MultiplayerTeam>(); public List<MultiplayerTeam> Teams { get; set; } = new List<MultiplayerTeam>();
public static TeamVsMatchRoomState CreateDefault() => public static TeamVersusRoomState CreateDefault() =>
new TeamVsMatchRoomState new TeamVersusRoomState
{ {
Teams = Teams =
{ {

View File

@ -5,9 +5,9 @@ using MessagePack;
#nullable enable #nullable enable
namespace osu.Game.Online.Multiplayer.MatchRulesets.TeamVs namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
{ {
public class TeamVsMatchUserState : MatchRulesetUserState public class TeamVersusUserState : MatchUserState
{ {
[Key(0)] [Key(0)]
public int TeamID { get; set; } public int TeamID { get; set; }

View File

@ -7,11 +7,11 @@ using MessagePack;
namespace osu.Game.Online.Multiplayer namespace osu.Game.Online.Multiplayer
{ {
/// <summary> /// <summary>
/// A request from a user to perform an action specific to the current match ruleset. /// A request from a user to perform an action specific to the current match type.
/// </summary> /// </summary>
[Serializable] [Serializable]
[MessagePackObject] [MessagePackObject]
public abstract class MatchRulesetUserRequest public abstract class MatchUserRequest
{ {
} }
} }

View File

@ -3,20 +3,21 @@
using System; using System;
using MessagePack; using MessagePack;
using osu.Game.Online.Multiplayer.MatchRulesets.TeamVs; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
#nullable enable #nullable enable
namespace osu.Game.Online.Multiplayer namespace osu.Game.Online.Multiplayer
{ {
/// <summary> /// <summary>
/// User specific state for the current match ruleset. /// User specific state for the current match type.
/// Can be used to contain any state which should be used before or during match gameplay. /// Can be used to contain any state which should be used before or during match gameplay.
/// </summary> /// </summary>
[Serializable] [Serializable]
[MessagePackObject] [MessagePackObject]
[Union(0, typeof(TeamVsMatchUserState))] [Union(0, typeof(TeamVersusUserState))]
public class MatchRulesetUserState // TODO: this will need to be abstract or interface when/if we get messagepack working. for now it isn't as it breaks json serialisation. // TODO: this will need to be abstract or interface when/if we get messagepack working. for now it isn't as it breaks json serialisation.
public class MatchUserState
{ {
} }
} }

View File

@ -293,7 +293,7 @@ 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 SendMatchRequest(MatchUserRequest request);
public abstract Task StartMatch(); public abstract Task StartMatch();
@ -422,7 +422,7 @@ namespace osu.Game.Online.Multiplayer
return Task.CompletedTask; return Task.CompletedTask;
} }
Task IMultiplayerClient.MatchRulesetUserStateChanged(int userId, MatchRulesetUserState state) Task IMultiplayerClient.MatchUserStateChanged(int userId, MatchUserState state)
{ {
if (Room == null) if (Room == null)
return Task.CompletedTask; return Task.CompletedTask;
@ -432,14 +432,14 @@ namespace osu.Game.Online.Multiplayer
if (Room == null) if (Room == null)
return; return;
Room.Users.Single(u => u.UserID == userId).MatchRulesetState = state; Room.Users.Single(u => u.UserID == userId).MatchState = state;
RoomUpdated?.Invoke(); RoomUpdated?.Invoke();
}, false); }, false);
return Task.CompletedTask; return Task.CompletedTask;
} }
Task IMultiplayerClient.MatchRulesetRoomStateChanged(MatchRulesetRoomState state) Task IMultiplayerClient.MatchRoomStateChanged(MatchRoomState state)
{ {
if (Room == null) if (Room == null)
return Task.CompletedTask; return Task.CompletedTask;
@ -449,16 +449,16 @@ namespace osu.Game.Online.Multiplayer
if (Room == null) if (Room == null)
return; return;
Room.MatchRulesetState = state; Room.MatchState = state;
RoomUpdated?.Invoke(); RoomUpdated?.Invoke();
}, false); }, false);
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task MatchRulesetEvent(MatchRulesetServerEvent e) public Task MatchEvent(MatchServerEvent e)
{ {
// not used by any match rulesets just yet. // not used by any match types just yet.
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Online.Multiplayer
public MultiplayerRoomUser? Host { get; set; } public MultiplayerRoomUser? Host { get; set; }
[Key(5)] [Key(5)]
public MatchRulesetRoomState? MatchRulesetState { get; set; } public MatchRoomState? MatchState { get; set; }
[JsonConstructor] [JsonConstructor]
[SerializationConstructor] [SerializationConstructor]

View File

@ -41,7 +41,7 @@ namespace osu.Game.Online.Multiplayer
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
[Key(8)] [Key(8)]
public MatchType MatchRulesetType { get; set; } public MatchType MatchType { get; set; }
public bool Equals(MultiplayerRoomSettings other) public bool Equals(MultiplayerRoomSettings other)
=> BeatmapID == other.BeatmapID => BeatmapID == other.BeatmapID
@ -52,7 +52,7 @@ namespace osu.Game.Online.Multiplayer
&& Password.Equals(other.Password, StringComparison.Ordinal) && Password.Equals(other.Password, StringComparison.Ordinal)
&& Name.Equals(other.Name, StringComparison.Ordinal) && Name.Equals(other.Name, StringComparison.Ordinal)
&& PlaylistItemId == other.PlaylistItemId && PlaylistItemId == other.PlaylistItemId
&& MatchRulesetType == other.MatchRulesetType; && MatchType == other.MatchType;
public override string ToString() => $"Name:{Name}" public override string ToString() => $"Name:{Name}"
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})" + $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
@ -60,7 +60,7 @@ namespace osu.Game.Online.Multiplayer
+ $" AllowedMods:{string.Join(',', AllowedMods)}" + $" AllowedMods:{string.Join(',', AllowedMods)}"
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}" + $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
+ $" Ruleset:{RulesetID}" + $" Ruleset:{RulesetID}"
+ $" MatchRuleset:{MatchRulesetType}" + $" Type:{MatchType}"
+ $" Item:{PlaylistItemId}"; + $" Item:{PlaylistItemId}";
} }
} }

View File

@ -25,7 +25,7 @@ namespace osu.Game.Online.Multiplayer
public MultiplayerUserState State { get; set; } = MultiplayerUserState.Idle; public MultiplayerUserState State { get; set; } = MultiplayerUserState.Idle;
[Key(4)] [Key(4)]
public MatchRulesetUserState? MatchRulesetState { get; set; } public MatchUserState? MatchState { get; set; }
/// <summary> /// <summary>
/// The availability state of the current beatmap. /// The availability state of the current beatmap.

View File

@ -58,8 +58,8 @@ namespace osu.Game.Online.Multiplayer
connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady); connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady);
connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged); connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged);
connection.On<int, BeatmapAvailability>(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged); connection.On<int, BeatmapAvailability>(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged);
connection.On<MatchRulesetRoomState>(nameof(IMultiplayerClient.MatchRulesetRoomStateChanged), ((IMultiplayerClient)this).MatchRulesetRoomStateChanged); connection.On<MatchRoomState>(nameof(IMultiplayerClient.MatchRoomStateChanged), ((IMultiplayerClient)this).MatchRoomStateChanged);
connection.On<int, MatchRulesetUserState>(nameof(IMultiplayerClient.MatchRulesetUserStateChanged), ((IMultiplayerClient)this).MatchRulesetUserStateChanged); connection.On<int, MatchUserState>(nameof(IMultiplayerClient.MatchUserStateChanged), ((IMultiplayerClient)this).MatchUserStateChanged);
}; };
IsConnected.BindTo(connector.IsConnected); IsConnected.BindTo(connector.IsConnected);
@ -122,12 +122,12 @@ 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) public override Task SendMatchRequest(MatchUserRequest request)
{ {
if (!IsConnected.Value) if (!IsConnected.Value)
return Task.CompletedTask; return Task.CompletedTask;
return connection.InvokeAsync(nameof(IMultiplayerServer.SendMatchRulesetRequest), request); return connection.InvokeAsync(nameof(IMultiplayerServer.SendMatchRequest), request);
} }
public override Task StartMatch() public override Task StartMatch()

View File

@ -192,7 +192,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
return Task.CompletedTask; return Task.CompletedTask;
} }
public override Task SendMatchRulesetRequest(MatchRulesetUserRequest request) => Task.CompletedTask; public override Task SendMatchRequest(MatchUserRequest request) => Task.CompletedTask;
public override Task StartMatch() public override Task StartMatch()
{ {