1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 07:32:58 +08:00

Merge pull request #11792 from peppy/rooms-fix-selection-after-create

Fix current selection not updating visually after creating a new playlist
This commit is contained in:
Dan Balasescu 2021-02-16 15:05:03 +09:00 committed by GitHub
commit c9a70a6777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,8 +69,16 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
rooms.BindTo(roomManager.Rooms);
filter?.BindValueChanged(criteria => Filter(criteria.NewValue));
selectedRoom.BindValueChanged(selection =>
{
updateSelection();
}, true);
}
private void updateSelection() =>
roomFlow.Children.ForEach(r => r.State = r.Room == selectedRoom.Value ? SelectionState.Selected : SelectionState.NotSelected);
public void Filter(FilterCriteria criteria)
{
roomFlow.Children.ForEach(r =>
@ -125,6 +133,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
}
Filter(filter?.Value);
updateSelection();
}
private void removeRooms(IEnumerable<Room> rooms)
@ -146,11 +156,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
roomFlow.SetLayoutPosition(room, room.Room.Position.Value);
}
private void selectRoom(Room room)
{
roomFlow.Children.ForEach(r => r.State = r.Room == room ? SelectionState.Selected : SelectionState.NotSelected);
selectedRoom.Value = room;
}
private void selectRoom(Room room) => selectedRoom.Value = room;
private void joinSelected()
{