Add setting for queue mode

This commit is contained in:
smoogipoo 2021-10-20 14:51:59 +09:00
parent 2fd101ad50
commit ea9c070e59
4 changed files with 28 additions and 5 deletions

View File

@ -44,7 +44,7 @@ public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
public MatchType MatchType { get; set; } = MatchType.HeadToHead;
[Key(9)]
public QueueingModes QueueingMode { get; set; } = QueueingModes.Host;
public QueueModes QueueMode { get; set; } = QueueModes.HostPick;
public bool Equals(MultiplayerRoomSettings other)
=> BeatmapID == other.BeatmapID
@ -56,7 +56,7 @@ public bool Equals(MultiplayerRoomSettings other)
&& Name.Equals(other.Name, StringComparison.Ordinal)
&& PlaylistItemId == other.PlaylistItemId
&& MatchType == other.MatchType
&& QueueingMode == other.QueueingMode;
&& QueueMode == other.QueueMode;
public override string ToString() => $"Name:{Name}"
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
@ -66,6 +66,6 @@ public override string ToString() => $"Name:{Name}"
+ $" Ruleset:{RulesetID}"
+ $" Type:{MatchType}"
+ $" Item:{PlaylistItemId}"
+ $" Queue:{QueueingMode}";
+ $" Queue:{QueueMode}";
}
}

View File

@ -3,9 +3,11 @@
namespace osu.Game.Online.Multiplayer
{
public enum QueueingModes
public enum QueueModes
{
Host,
// used for osu-web deserialization so names shouldn't be changed.
HostPick,
Karaoke,
}
}

View File

@ -7,6 +7,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.IO.Serialization.Converters;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms.RoomStatuses;
using osu.Game.Users;
using osu.Game.Utils;
@ -73,6 +74,18 @@ private MatchType type
set => Type.Value = value;
}
[Cached]
[JsonIgnore]
public readonly Bindable<QueueModes> QueueMode = new Bindable<QueueModes>();
[JsonConverter(typeof(SnakeCaseStringEnumConverter))]
[JsonProperty("queue_mode")]
private QueueModes queueMode
{
get => QueueMode.Value;
set => QueueMode.Value = value;
}
[Cached]
[JsonIgnore]
public readonly Bindable<int?> MaxParticipants = new Bindable<int?>();

View File

@ -59,6 +59,7 @@ protected class MatchSettings : OnlinePlayComposite
public OsuTextBox NameField, MaxParticipantsField;
public RoomAvailabilityPicker AvailabilityPicker;
public MatchTypePicker TypePicker;
public OsuEnumDropdown<QueueModes> QueueModeDropdown;
public OsuTextBox PasswordTextBox;
public TriangleButton ApplyButton;
@ -190,6 +191,13 @@ private void load(OverlayColourProvider colourProvider, OsuColour colours)
},
},
},
new Section("Beatmap queueing mode")
{
Child = QueueModeDropdown = new OsuEnumDropdown<QueueModes>
{
RelativeSizeAxes = Axes.X
}
}
},
},
new SectionContainer