1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +08:00

Make Room.AutoSkip non-bindable

This commit is contained in:
Dan Balasescu 2024-11-13 19:15:29 +09:00
parent ec5be6dbc3
commit f001cce24a
No known key found for this signature in database
5 changed files with 25 additions and 14 deletions

View File

@ -848,7 +848,7 @@ namespace osu.Game.Online.Multiplayer
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();
}

View File

@ -104,6 +104,15 @@ namespace osu.Game.Online.Rooms
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 @@ namespace osu.Game.Online.Rooms
set => SetField(ref availability, value);
}
[JsonProperty("id")]
private long? roomId;
@ -162,6 +170,9 @@ namespace osu.Game.Online.Rooms
[JsonProperty("queue_mode")]
private QueueMode queueMode;
[JsonProperty("auto_skip")]
private bool autoSkip;
[JsonProperty("current_playlist_item")]
private PlaylistItem? currentPlaylistItem;
@ -253,10 +264,6 @@ namespace osu.Game.Online.Rooms
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 @@ namespace osu.Game.Online.Rooms
DifficultyRange.Value = other.DifficultyRange.Value;
PlaylistItemStats.Value = other.PlaylistItemStats.Value;
CurrentPlaylistItem = other.CurrentPlaylistItem;
AutoSkip.Value = other.AutoSkip.Value;
AutoSkip = other.AutoSkip;
other.RemoveExpiredPlaylistItems();

View File

@ -352,7 +352,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
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 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
updateRoomType();
updateRoomQueueMode();
updateRoomPassword();
updateRoomAutoSkip();
}
private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
@ -398,6 +398,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
case nameof(Room.Password):
updateRoomPassword();
break;
case nameof(Room.AutoSkip):
updateRoomAutoSkip();
break;
}
}
@ -413,6 +417,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
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 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
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;

View File

@ -50,8 +50,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
AllowPause = false,
AllowRestart = false,
AllowFailAnimation = false,
AllowSkipping = room.AutoSkip.Value,
AutomaticallySkipIntro = room.AutoSkip.Value,
AllowSkipping = room.AutoSkip,
AutomaticallySkipIntro = room.AutoSkip,
AlwaysShowLeaderboard = true,
})
{

View File

@ -50,8 +50,5 @@ namespace osu.Game.Screens.OnlinePlay
[Resolved(typeof(Room))]
protected Bindable<TimeSpan> AutoStartDuration { get; private set; } = null!;
[Resolved(typeof(Room))]
protected Bindable<bool> AutoSkip { get; private set; } = null!;
}
}