1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-17 18:37:19 +08:00

Hook up room-level max attempts to UI

This commit is contained in:
Dean Herbert 2021-02-02 17:57:23 +09:00
parent 44ed705388
commit 6fdaf02518
2 changed files with 18 additions and 30 deletions

View File

@ -39,6 +39,9 @@ namespace osu.Game.Screens.OnlinePlay
[Resolved(typeof(Room))]
protected Bindable<int?> MaxParticipants { get; private set; }
[Resolved(typeof(Room))]
protected Bindable<int?> MaxAttempts { get; private set; }
[Resolved(typeof(Room))]
protected Bindable<DateTimeOffset?> EndDate { get; private set; }

View File

@ -42,15 +42,13 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
public Action EditPlaylist;
public OsuTextBox NameField, MaxParticipantsField;
public OsuTextBox NameField, MaxParticipantsField, MaxAttemptsField;
public OsuDropdown<TimeSpan> DurationField;
public RoomAvailabilityPicker AvailabilityPicker;
public GameTypePicker TypePicker;
public TriangleButton ApplyButton;
public OsuSpriteText ErrorText;
private OsuSpriteText typeLabel;
private LoadingLayer loadingLayer;
private DrawableRoomPlaylist playlist;
private OsuSpriteText playlistLength;
@ -134,6 +132,15 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
}
}
},
new Section("Allowed attempts (across all playlist items)")
{
Child = MaxAttemptsField = new SettingsNumberTextBox
{
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this,
PlaceholderText = "Unlimited",
},
},
new Section("Room visibility")
{
Alpha = disabled_alpha,
@ -142,30 +149,6 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
Enabled = { Value = false }
},
},
new Section("Game type")
{
Alpha = disabled_alpha,
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Spacing = new Vector2(7),
Children = new Drawable[]
{
TypePicker = new GameTypePicker
{
RelativeSizeAxes = Axes.X,
Enabled = { Value = false }
},
typeLabel = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 14),
Colour = colours.Yellow
},
},
},
},
new Section("Max participants")
{
Alpha = disabled_alpha,
@ -294,10 +277,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
loadingLayer = new LoadingLayer(true)
};
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true);
Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
Duration.BindValueChanged(duration => DurationField.Current.Value = duration.NewValue ?? TimeSpan.FromMinutes(30), true);
@ -326,13 +307,17 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
RoomName.Value = NameField.Text;
Availability.Value = AvailabilityPicker.Current.Value;
Type.Value = TypePicker.Current.Value;
if (int.TryParse(MaxParticipantsField.Text, out int max))
MaxParticipants.Value = max;
else
MaxParticipants.Value = null;
if (int.TryParse(MaxAttemptsField.Text, out max))
MaxAttempts.Value = max;
else
MaxAttempts.Value = null;
Duration.Value = DurationField.Current.Value;
manager?.CreateRoom(currentRoom.Value, onSuccess, onError);