mirror of
https://github.com/ppy/osu.git
synced 2025-03-06 19:07:19 +08:00
Add password to room settings and multiplayer lounge interface
This commit is contained in:
parent
6a74fde082
commit
2ca11d458a
@ -15,6 +15,16 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomId">The databased room ID.</param>
|
/// <param name="roomId">The databased room ID.</param>
|
||||||
/// <exception cref="InvalidStateException">If the user is already in the requested (or another) room.</exception>
|
/// <exception cref="InvalidStateException">If the user is already in the requested (or another) room.</exception>
|
||||||
|
/// <exception cref="InvalidPasswordException">If the room required a password.</exception>
|
||||||
Task<MultiplayerRoom> JoinRoom(long roomId);
|
Task<MultiplayerRoom> JoinRoom(long roomId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request to join a multiplayer room with a provided password.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roomId">The databased room ID.</param>
|
||||||
|
/// <param name="password">The password for the join request.</param>
|
||||||
|
/// <exception cref="InvalidStateException">If the user is already in the requested (or another) room.</exception>
|
||||||
|
/// <exception cref="InvalidPasswordException">If the room provided password was incorrect.</exception>
|
||||||
|
Task<MultiplayerRoom> JoinRoom(long roomId, string password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
osu.Game/Online/Multiplayer/InvalidPasswordException.cs
Normal file
22
osu.Game/Online/Multiplayer/InvalidPasswordException.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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 System.Runtime.Serialization;
|
||||||
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class InvalidPasswordException : HubException
|
||||||
|
{
|
||||||
|
public InvalidPasswordException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InvalidPasswordException(SerializationInfo info, StreamingContext context)
|
||||||
|
: base(info, context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -212,6 +212,8 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
return ChangeSettings(new MultiplayerRoomSettings
|
return ChangeSettings(new MultiplayerRoomSettings
|
||||||
{
|
{
|
||||||
Name = name.GetOr(Room.Settings.Name),
|
Name = name.GetOr(Room.Settings.Name),
|
||||||
|
// TODO: add changing support
|
||||||
|
Password = Room.Settings.Password,
|
||||||
BeatmapID = item.GetOr(existingPlaylistItem).BeatmapID,
|
BeatmapID = item.GetOr(existingPlaylistItem).BeatmapID,
|
||||||
BeatmapChecksum = item.GetOr(existingPlaylistItem).Beatmap.Value.MD5Hash,
|
BeatmapChecksum = item.GetOr(existingPlaylistItem).Beatmap.Value.MD5Hash,
|
||||||
RulesetID = item.GetOr(existingPlaylistItem).RulesetID,
|
RulesetID = item.GetOr(existingPlaylistItem).RulesetID,
|
||||||
|
@ -36,12 +36,16 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[Key(6)]
|
[Key(6)]
|
||||||
public long PlaylistItemId { get; set; }
|
public long PlaylistItemId { get; set; }
|
||||||
|
|
||||||
|
[Key(7)]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
public bool Equals(MultiplayerRoomSettings other)
|
public bool Equals(MultiplayerRoomSettings other)
|
||||||
=> BeatmapID == other.BeatmapID
|
=> BeatmapID == other.BeatmapID
|
||||||
&& BeatmapChecksum == other.BeatmapChecksum
|
&& BeatmapChecksum == other.BeatmapChecksum
|
||||||
&& RequiredMods.SequenceEqual(other.RequiredMods)
|
&& RequiredMods.SequenceEqual(other.RequiredMods)
|
||||||
&& AllowedMods.SequenceEqual(other.AllowedMods)
|
&& AllowedMods.SequenceEqual(other.AllowedMods)
|
||||||
&& RulesetID == other.RulesetID
|
&& RulesetID == other.RulesetID
|
||||||
|
&& Password.Equals(other.Password, StringComparison.Ordinal)
|
||||||
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
||||||
&& PlaylistItemId == other.PlaylistItemId;
|
&& PlaylistItemId == other.PlaylistItemId;
|
||||||
|
|
||||||
@ -49,6 +53,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
|
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
|
||||||
+ $" RequiredMods:{string.Join(',', RequiredMods)}"
|
+ $" RequiredMods:{string.Join(',', RequiredMods)}"
|
||||||
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
|
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
|
||||||
|
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
||||||
+ $" Ruleset:{RulesetID}"
|
+ $" Ruleset:{RulesetID}"
|
||||||
+ $" Item:{PlaylistItemId}";
|
+ $" Item:{PlaylistItemId}";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user