mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 16:12:57 +08:00
Add implementation to settings overlay
This commit is contained in:
parent
0e446105fb
commit
599867a3b1
@ -212,7 +212,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// <param name="password">The new password, if any.</param>
|
/// <param name="password">The new password, if any.</param>
|
||||||
/// <param name="matchType">The type of the match, if any.</param>
|
/// <param name="matchType">The type of the match, 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<string> password = default, Optional<MatchType> matchType = default, Optional<PlaylistItem> item = default)
|
/// <param name="queueMode">The new queue mode, if any.</param>
|
||||||
|
public Task ChangeSettings(Optional<string> name = default, Optional<string> password = default, Optional<MatchType> matchType = default, Optional<PlaylistItem> item = default,
|
||||||
|
Optional<QueueModes> queueMode = 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.");
|
||||||
@ -239,6 +241,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
BeatmapChecksum = item.GetOr(existingPlaylistItem).Beatmap.Value.MD5Hash,
|
BeatmapChecksum = item.GetOr(existingPlaylistItem).Beatmap.Value.MD5Hash,
|
||||||
RulesetID = item.GetOr(existingPlaylistItem).RulesetID,
|
RulesetID = item.GetOr(existingPlaylistItem).RulesetID,
|
||||||
MatchType = matchType.GetOr(Room.Settings.MatchType),
|
MatchType = matchType.GetOr(Room.Settings.MatchType),
|
||||||
|
QueueMode = queueMode.GetOr(Room.Settings.QueueMode),
|
||||||
RequiredMods = item.HasValue ? item.Value.AsNonNull().RequiredMods.Select(m => new APIMod(m)).ToList() : Room.Settings.RequiredMods,
|
RequiredMods = item.HasValue ? item.Value.AsNonNull().RequiredMods.Select(m => new APIMod(m)).ToList() : Room.Settings.RequiredMods,
|
||||||
AllowedMods = item.HasValue ? item.Value.AsNonNull().AllowedMods.Select(m => new APIMod(m)).ToList() : Room.Settings.AllowedMods,
|
AllowedMods = item.HasValue ? item.Value.AsNonNull().AllowedMods.Select(m => new APIMod(m)).ToList() : Room.Settings.AllowedMods,
|
||||||
});
|
});
|
||||||
|
@ -339,7 +339,12 @@ 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, password: PasswordTextBox.Text, matchType: TypePicker.Current.Value).ContinueWith(t => Schedule(() =>
|
client.ChangeSettings(
|
||||||
|
name: NameField.Text,
|
||||||
|
password: PasswordTextBox.Text,
|
||||||
|
matchType: TypePicker.Current.Value,
|
||||||
|
queueMode: QueueModeDropdown.Current.Value)
|
||||||
|
.ContinueWith(t => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (t.IsCompletedSuccessfully)
|
if (t.IsCompletedSuccessfully)
|
||||||
onSuccess(room);
|
onSuccess(room);
|
||||||
@ -353,6 +358,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
room.Availability.Value = AvailabilityPicker.Current.Value;
|
room.Availability.Value = AvailabilityPicker.Current.Value;
|
||||||
room.Type.Value = TypePicker.Current.Value;
|
room.Type.Value = TypePicker.Current.Value;
|
||||||
room.Password.Value = PasswordTextBox.Current.Value;
|
room.Password.Value = PasswordTextBox.Current.Value;
|
||||||
|
room.QueueMode.Value = QueueModeDropdown.Current.Value;
|
||||||
|
|
||||||
if (int.TryParse(MaxParticipantsField.Text, out int max))
|
if (int.TryParse(MaxParticipantsField.Text, out int max))
|
||||||
room.MaxParticipants.Value = max;
|
room.MaxParticipants.Value = max;
|
||||||
|
Loading…
Reference in New Issue
Block a user