mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 22:22:55 +08:00
Add support for updating a room's password
This commit is contained in:
parent
84b0a3290c
commit
08c40938db
@ -127,7 +127,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
Debug.Assert(room.RoomID.Value != null);
|
Debug.Assert(room.RoomID.Value != null);
|
||||||
|
|
||||||
// Join the server-side room.
|
// Join the server-side room.
|
||||||
var joinedRoom = await JoinRoom(room.RoomID.Value.Value).ConfigureAwait(false);
|
var joinedRoom = await JoinRoom(room.RoomID.Value.Value, room.Password.Value).ConfigureAwait(false);
|
||||||
Debug.Assert(joinedRoom != null);
|
Debug.Assert(joinedRoom != null);
|
||||||
|
|
||||||
// Populate users.
|
// Populate users.
|
||||||
@ -190,8 +190,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// A room must be joined for this to have any effect.
|
/// A room must be joined for this to have any effect.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="name">The new room name, if any.</param>
|
/// <param name="name">The new room name, if any.</param>
|
||||||
|
/// <param name="password">The new password, if any.</param>
|
||||||
/// <param name="item">The new room playlist item, if any.</param>
|
/// <param name="item">The new room playlist item, if any.</param>
|
||||||
public Task ChangeSettings(Optional<string> name = default, Optional<PlaylistItem> item = default)
|
public Task ChangeSettings(Optional<string> name = default, Optional<string> password = default, Optional<PlaylistItem> item = default)
|
||||||
{
|
{
|
||||||
if (Room == null)
|
if (Room == null)
|
||||||
throw new InvalidOperationException("Must be joined to a match to change settings.");
|
throw new InvalidOperationException("Must be joined to a match to change settings.");
|
||||||
@ -213,8 +214,7 @@ 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 = password.GetOr(Room.Settings.Password),
|
||||||
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,
|
||||||
|
@ -303,7 +303,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
// Otherwise, update the room directly in preparation for it to be submitted to the API on match creation.
|
// Otherwise, update the room directly in preparation for it to be submitted to the API on match creation.
|
||||||
if (client.Room != null)
|
if (client.Room != null)
|
||||||
{
|
{
|
||||||
client.ChangeSettings(name: NameField.Text).ContinueWith(t => Schedule(() =>
|
client.ChangeSettings(name: NameField.Text, password: PasswordTextBox.Text).ContinueWith(t => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (t.IsCompletedSuccessfully)
|
if (t.IsCompletedSuccessfully)
|
||||||
onSuccess(currentRoom.Value);
|
onSuccess(currentRoom.Value);
|
||||||
|
Loading…
Reference in New Issue
Block a user