mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:02:55 +08:00
Drop MatchRuleset
terminology completely
This commit is contained in:
parent
66427127f0
commit
70da58323a
@ -51,23 +51,23 @@ namespace osu.Game.Online.Multiplayer
|
||||
Task UserStateChanged(int userId, MultiplayerUserState state);
|
||||
|
||||
/// <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>
|
||||
/// <param name="userId">The ID of the user performing a state change.</param>
|
||||
/// <param name="state">The new state of the user.</param>
|
||||
Task MatchRulesetUserStateChanged(int userId, MatchRulesetUserState state);
|
||||
Task MatchUserStateChanged(int userId, MatchUserState state);
|
||||
|
||||
/// <summary>
|
||||
/// Signals that the match ruleset state has changed for this room.
|
||||
/// Signals that the match type state has changed for this room.
|
||||
/// </summary>
|
||||
/// <param name="state">The new state of the room.</param>
|
||||
Task MatchRulesetRoomStateChanged(MatchRulesetRoomState state);
|
||||
Task MatchRoomStateChanged(MatchRoomState state);
|
||||
|
||||
/// <summary>
|
||||
/// Send a match ruleset specific request.
|
||||
/// Send a match type specific request.
|
||||
/// </summary>
|
||||
/// <param name="e">The event to handle.</param>
|
||||
Task MatchRulesetEvent(MatchRulesetServerEvent e);
|
||||
Task MatchEvent(MatchServerEvent e);
|
||||
|
||||
/// <summary>
|
||||
/// Signals that a user in this room changed their beatmap availability state.
|
||||
|
@ -56,10 +56,10 @@ namespace osu.Game.Online.Multiplayer
|
||||
Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||
|
||||
/// <summary>
|
||||
/// Send a match ruleset specific request.
|
||||
/// Send a match type specific request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to send.</param>
|
||||
Task SendMatchRulesetRequest(MatchRulesetUserRequest request);
|
||||
Task SendMatchRequest(MatchUserRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// As the host of a room, start the match.
|
||||
|
@ -3,20 +3,21 @@
|
||||
|
||||
using System;
|
||||
using MessagePack;
|
||||
using osu.Game.Online.Multiplayer.MatchRulesets.TeamVs;
|
||||
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
/// <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.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
[Union(0, typeof(TeamVsMatchRoomState))]
|
||||
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.
|
||||
[Union(0, typeof(TeamVersusRoomState))]
|
||||
// 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
|
||||
{
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
public abstract class MatchRulesetServerEvent
|
||||
public abstract class MatchServerEvent
|
||||
{
|
||||
}
|
||||
}
|
@ -5,9 +5,9 @@ using MessagePack;
|
||||
|
||||
#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)]
|
||||
public int TeamID { get; set; }
|
@ -6,7 +6,7 @@ using MessagePack;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Online.Multiplayer.MatchRulesets.TeamVs
|
||||
namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
|
||||
{
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
@ -6,16 +6,16 @@ using MessagePack;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Online.Multiplayer.MatchRulesets.TeamVs
|
||||
namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
|
||||
{
|
||||
[MessagePackObject]
|
||||
public class TeamVsMatchRoomState : MatchRulesetRoomState
|
||||
public class TeamVersusRoomState : MatchRoomState
|
||||
{
|
||||
[Key(0)]
|
||||
public List<MultiplayerTeam> Teams { get; set; } = new List<MultiplayerTeam>();
|
||||
|
||||
public static TeamVsMatchRoomState CreateDefault() =>
|
||||
new TeamVsMatchRoomState
|
||||
public static TeamVersusRoomState CreateDefault() =>
|
||||
new TeamVersusRoomState
|
||||
{
|
||||
Teams =
|
||||
{
|
@ -5,9 +5,9 @@ using MessagePack;
|
||||
|
||||
#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)]
|
||||
public int TeamID { get; set; }
|
@ -7,11 +7,11 @@ using MessagePack;
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
/// <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>
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
public abstract class MatchRulesetUserRequest
|
||||
public abstract class MatchUserRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -3,20 +3,21 @@
|
||||
|
||||
using System;
|
||||
using MessagePack;
|
||||
using osu.Game.Online.Multiplayer.MatchRulesets.TeamVs;
|
||||
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
/// <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.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
[Union(0, typeof(TeamVsMatchUserState))]
|
||||
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.
|
||||
[Union(0, typeof(TeamVersusUserState))]
|
||||
// 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
|
||||
{
|
||||
}
|
||||
}
|
@ -293,7 +293,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
|
||||
public abstract Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||
|
||||
public abstract Task SendMatchRulesetRequest(MatchRulesetUserRequest request);
|
||||
public abstract Task SendMatchRequest(MatchUserRequest request);
|
||||
|
||||
public abstract Task StartMatch();
|
||||
|
||||
@ -422,7 +422,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
Task IMultiplayerClient.MatchRulesetUserStateChanged(int userId, MatchRulesetUserState state)
|
||||
Task IMultiplayerClient.MatchUserStateChanged(int userId, MatchUserState state)
|
||||
{
|
||||
if (Room == null)
|
||||
return Task.CompletedTask;
|
||||
@ -432,14 +432,14 @@ namespace osu.Game.Online.Multiplayer
|
||||
if (Room == null)
|
||||
return;
|
||||
|
||||
Room.Users.Single(u => u.UserID == userId).MatchRulesetState = state;
|
||||
Room.Users.Single(u => u.UserID == userId).MatchState = state;
|
||||
RoomUpdated?.Invoke();
|
||||
}, false);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
Task IMultiplayerClient.MatchRulesetRoomStateChanged(MatchRulesetRoomState state)
|
||||
Task IMultiplayerClient.MatchRoomStateChanged(MatchRoomState state)
|
||||
{
|
||||
if (Room == null)
|
||||
return Task.CompletedTask;
|
||||
@ -449,16 +449,16 @@ namespace osu.Game.Online.Multiplayer
|
||||
if (Room == null)
|
||||
return;
|
||||
|
||||
Room.MatchRulesetState = state;
|
||||
Room.MatchState = state;
|
||||
RoomUpdated?.Invoke();
|
||||
}, false);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
public MultiplayerRoomUser? Host { get; set; }
|
||||
|
||||
[Key(5)]
|
||||
public MatchRulesetRoomState? MatchRulesetState { get; set; }
|
||||
public MatchRoomState? MatchState { get; set; }
|
||||
|
||||
[JsonConstructor]
|
||||
[SerializationConstructor]
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[Key(8)]
|
||||
public MatchType MatchRulesetType { get; set; }
|
||||
public MatchType MatchType { get; set; }
|
||||
|
||||
public bool Equals(MultiplayerRoomSettings other)
|
||||
=> BeatmapID == other.BeatmapID
|
||||
@ -52,7 +52,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
&& Password.Equals(other.Password, StringComparison.Ordinal)
|
||||
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
||||
&& PlaylistItemId == other.PlaylistItemId
|
||||
&& MatchRulesetType == other.MatchRulesetType;
|
||||
&& MatchType == other.MatchType;
|
||||
|
||||
public override string ToString() => $"Name:{Name}"
|
||||
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
|
||||
@ -60,7 +60,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
|
||||
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
||||
+ $" Ruleset:{RulesetID}"
|
||||
+ $" MatchRuleset:{MatchRulesetType}"
|
||||
+ $" Type:{MatchType}"
|
||||
+ $" Item:{PlaylistItemId}";
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
public MultiplayerUserState State { get; set; } = MultiplayerUserState.Idle;
|
||||
|
||||
[Key(4)]
|
||||
public MatchRulesetUserState? MatchRulesetState { get; set; }
|
||||
public MatchUserState? MatchState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The availability state of the current beatmap.
|
||||
|
@ -58,8 +58,8 @@ namespace osu.Game.Online.Multiplayer
|
||||
connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady);
|
||||
connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged);
|
||||
connection.On<int, BeatmapAvailability>(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged);
|
||||
connection.On<MatchRulesetRoomState>(nameof(IMultiplayerClient.MatchRulesetRoomStateChanged), ((IMultiplayerClient)this).MatchRulesetRoomStateChanged);
|
||||
connection.On<int, MatchRulesetUserState>(nameof(IMultiplayerClient.MatchRulesetUserStateChanged), ((IMultiplayerClient)this).MatchRulesetUserStateChanged);
|
||||
connection.On<MatchRoomState>(nameof(IMultiplayerClient.MatchRoomStateChanged), ((IMultiplayerClient)this).MatchRoomStateChanged);
|
||||
connection.On<int, MatchUserState>(nameof(IMultiplayerClient.MatchUserStateChanged), ((IMultiplayerClient)this).MatchUserStateChanged);
|
||||
};
|
||||
|
||||
IsConnected.BindTo(connector.IsConnected);
|
||||
@ -122,12 +122,12 @@ namespace osu.Game.Online.Multiplayer
|
||||
return connection.InvokeAsync(nameof(IMultiplayerServer.ChangeUserMods), newMods);
|
||||
}
|
||||
|
||||
public override Task SendMatchRulesetRequest(MatchRulesetUserRequest request)
|
||||
public override Task SendMatchRequest(MatchUserRequest request)
|
||||
{
|
||||
if (!IsConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
return connection.InvokeAsync(nameof(IMultiplayerServer.SendMatchRulesetRequest), request);
|
||||
return connection.InvokeAsync(nameof(IMultiplayerServer.SendMatchRequest), request);
|
||||
}
|
||||
|
||||
public override Task StartMatch()
|
||||
|
@ -192,7 +192,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override Task SendMatchRulesetRequest(MatchRulesetUserRequest request) => Task.CompletedTask;
|
||||
public override Task SendMatchRequest(MatchUserRequest request) => Task.CompletedTask;
|
||||
|
||||
public override Task StartMatch()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user