mirror of https://github.com/ppy/osu
Make `Room.AutoSkip` non-bindable
This commit is contained in:
parent
ec5be6dbc3
commit
f001cce24a
|
@ -848,7 +848,7 @@ private void updateLocalRoomSettings(MultiplayerRoomSettings settings)
|
|||
APIRoom.QueueMode = Room.Settings.QueueMode;
|
||||
APIRoom.AutoStartDuration.Value = Room.Settings.AutoStartDuration;
|
||||
APIRoom.CurrentPlaylistItem = APIRoom.Playlist.Single(item => item.ID == settings.PlaylistItemId);
|
||||
APIRoom.AutoSkip.Value = Room.Settings.AutoSkip;
|
||||
APIRoom.AutoSkip = Room.Settings.AutoSkip;
|
||||
|
||||
RoomUpdated?.Invoke();
|
||||
}
|
||||
|
|
|
@ -104,6 +104,15 @@ public QueueMode QueueMode
|
|||
set => SetField(ref queueMode, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to automatically skip map intros. Only valid for multiplayer rooms.
|
||||
/// </summary>
|
||||
public bool AutoSkip
|
||||
{
|
||||
get => autoSkip;
|
||||
set => SetField(ref autoSkip, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the current item selected within the room.
|
||||
/// </summary>
|
||||
|
@ -134,7 +143,6 @@ public RoomAvailability Availability
|
|||
set => SetField(ref availability, value);
|
||||
}
|
||||
|
||||
|
||||
[JsonProperty("id")]
|
||||
private long? roomId;
|
||||
|
||||
|
@ -162,6 +170,9 @@ public RoomAvailability Availability
|
|||
[JsonProperty("queue_mode")]
|
||||
private QueueMode queueMode;
|
||||
|
||||
[JsonProperty("auto_skip")]
|
||||
private bool autoSkip;
|
||||
|
||||
[JsonProperty("current_playlist_item")]
|
||||
private PlaylistItem? currentPlaylistItem;
|
||||
|
||||
|
@ -253,10 +264,6 @@ private int? maxAttempts
|
|||
set => MaxAttempts.Value = value;
|
||||
}
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("auto_skip")]
|
||||
public readonly Bindable<bool> AutoSkip = new Bindable<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Copies values from another <see cref="Room"/> into this one.
|
||||
/// </summary>
|
||||
|
@ -288,7 +295,7 @@ public void CopyFrom(Room other)
|
|||
DifficultyRange.Value = other.DifficultyRange.Value;
|
||||
PlaylistItemStats.Value = other.PlaylistItemStats.Value;
|
||||
CurrentPlaylistItem = other.CurrentPlaylistItem;
|
||||
AutoSkip.Value = other.AutoSkip.Value;
|
||||
AutoSkip = other.AutoSkip;
|
||||
|
||||
other.RemoveExpiredPlaylistItems();
|
||||
|
||||
|
|
|
@ -352,7 +352,6 @@ private void load(OverlayColourProvider colourProvider, OsuColour colours)
|
|||
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true);
|
||||
MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
|
||||
AutoStartDuration.BindValueChanged(duration => startModeDropdown.Current.Value = (StartMode)(int)duration.NewValue.TotalSeconds, true);
|
||||
AutoSkip.BindValueChanged(autoSkip => AutoSkipCheckbox.Current.Value = autoSkip.NewValue, true);
|
||||
|
||||
operationInProgress.BindTo(ongoingOperationTracker.InProgress);
|
||||
operationInProgress.BindValueChanged(v =>
|
||||
|
@ -377,6 +376,7 @@ protected override void LoadComplete()
|
|||
updateRoomType();
|
||||
updateRoomQueueMode();
|
||||
updateRoomPassword();
|
||||
updateRoomAutoSkip();
|
||||
}
|
||||
|
||||
private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
|
@ -398,6 +398,10 @@ private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
|||
case nameof(Room.Password):
|
||||
updateRoomPassword();
|
||||
break;
|
||||
|
||||
case nameof(Room.AutoSkip):
|
||||
updateRoomAutoSkip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,6 +417,9 @@ private void updateRoomQueueMode()
|
|||
private void updateRoomPassword()
|
||||
=> PasswordTextBox.Text = room.Password ?? string.Empty;
|
||||
|
||||
private void updateRoomAutoSkip()
|
||||
=> AutoSkipCheckbox.Current.Value = room.AutoSkip;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
@ -459,7 +466,7 @@ private void apply()
|
|||
room.Password = PasswordTextBox.Current.Value;
|
||||
room.QueueMode = QueueModeDropdown.Current.Value;
|
||||
room.AutoStartDuration.Value = autoStartDuration;
|
||||
room.AutoSkip.Value = AutoSkipCheckbox.Current.Value;
|
||||
room.AutoSkip = AutoSkipCheckbox.Current.Value;
|
||||
|
||||
if (int.TryParse(MaxParticipantsField.Text, out int max))
|
||||
room.MaxParticipants.Value = max;
|
||||
|
|
|
@ -50,8 +50,8 @@ public MultiplayerPlayer(Room room, PlaylistItem playlistItem, MultiplayerRoomUs
|
|||
AllowPause = false,
|
||||
AllowRestart = false,
|
||||
AllowFailAnimation = false,
|
||||
AllowSkipping = room.AutoSkip.Value,
|
||||
AutomaticallySkipIntro = room.AutoSkip.Value,
|
||||
AllowSkipping = room.AutoSkip,
|
||||
AutomaticallySkipIntro = room.AutoSkip,
|
||||
AlwaysShowLeaderboard = true,
|
||||
})
|
||||
{
|
||||
|
|
|
@ -50,8 +50,5 @@ public partial class OnlinePlayComposite : CompositeDrawable
|
|||
|
||||
[Resolved(typeof(Room))]
|
||||
protected Bindable<TimeSpan> AutoStartDuration { get; private set; } = null!;
|
||||
|
||||
[Resolved(typeof(Room))]
|
||||
protected Bindable<bool> AutoSkip { get; private set; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue