diff --git a/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs b/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs
index d2ee47bc23..001513be1f 100644
--- a/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs
+++ b/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs
@@ -19,7 +19,7 @@ namespace osu.Game.Tests.OnlinePlay
new PlaylistItem { ID = 3, BeatmapID = 1003, PlaylistOrder = 3 },
};
- var nextItem = items.GetNextItem();
+ var nextItem = items.GetCurrentItem();
Assert.That(nextItem, Is.EqualTo(items[0]));
}
@@ -34,7 +34,7 @@ namespace osu.Game.Tests.OnlinePlay
new PlaylistItem { ID = 3, BeatmapID = 1003, PlaylistOrder = 3 },
};
- var nextItem = items.GetNextItem();
+ var nextItem = items.GetCurrentItem();
Assert.That(nextItem, Is.EqualTo(items[1]));
}
@@ -49,7 +49,7 @@ namespace osu.Game.Tests.OnlinePlay
new PlaylistItem { ID = 3, BeatmapID = 1003, PlaylistOrder = 3 },
};
- var nextItem = items.GetNextItem();
+ var nextItem = items.GetCurrentItem();
Assert.That(nextItem, Is.EqualTo(items[2]));
}
@@ -64,7 +64,7 @@ namespace osu.Game.Tests.OnlinePlay
new PlaylistItem { ID = 3, BeatmapID = 1003, PlaylistOrder = 3, Expired = true },
};
- var nextItem = items.GetNextItem();
+ var nextItem = items.GetCurrentItem();
Assert.That(nextItem, Is.Null);
}
diff --git a/osu.Game/Online/Rooms/PlaylistExtensions.cs b/osu.Game/Online/Rooms/PlaylistExtensions.cs
index e900dc53ef..46cb218910 100644
--- a/osu.Game/Online/Rooms/PlaylistExtensions.cs
+++ b/osu.Game/Online/Rooms/PlaylistExtensions.cs
@@ -14,10 +14,10 @@ namespace osu.Game.Online.Rooms
public static class PlaylistExtensions
{
///
- /// Returns the next to be played from the supplied ,
+ /// Returns the first non-expired in playlist order from the supplied ,
/// or if all items are expired.
///
- public static PlaylistItem? GetNextItem(this IEnumerable playlist) =>
+ public static PlaylistItem? GetCurrentItem(this IEnumerable playlist) =>
playlist.OrderBy(item => item.PlaylistOrder).FirstOrDefault(item => !item.Expired);
public static string GetTotalDuration(this BindableList playlist) =>
diff --git a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs
index e2ba0b03b0..d144e1e3a9 100644
--- a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs
+++ b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs
@@ -1,10 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.Drawables;
+using osu.Game.Online.Rooms;
namespace osu.Game.Screens.OnlinePlay.Components
{
@@ -30,7 +30,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
private void updateBeatmap()
{
- sprite.Beatmap.Value = Playlist.FirstOrDefault()?.Beatmap.Value;
+ sprite.Beatmap.Value = Playlist.GetCurrentItem()?.Beatmap.Value;
}
protected virtual UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite(BeatmapSetCoverType) { RelativeSizeAxes = Axes.Both };
diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs
index 6c00ca2e81..926c35c5da 100644
--- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs
+++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs
@@ -3,7 +3,6 @@
#nullable enable
-using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Screens;
using osu.Game.Online.Rooms;
@@ -20,7 +19,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
public LoungeBackgroundScreen()
{
SelectedRoom.BindValueChanged(onSelectedRoomChanged);
- playlist.BindCollectionChanged((_, __) => PlaylistItem = playlist.FirstOrDefault());
+ playlist.BindCollectionChanged((_, __) => PlaylistItem = playlist.GetCurrentItem());
}
private void onSelectedRoomChanged(ValueChangedEvent room)
diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs
index 6b111d76a5..c833621fbc 100644
--- a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs
+++ b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs
@@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
@@ -73,7 +72,7 @@ namespace osu.Game.Screens.OnlinePlay
private IBindable subScreenSelectedItem { get; set; }
///
- /// The currently selected item in the , or the last item from
+ /// The currently selected item in the , or the current item from
/// if this is not within a .
///
protected readonly Bindable SelectedItem = new Bindable();
@@ -88,7 +87,7 @@ namespace osu.Game.Screens.OnlinePlay
protected virtual void UpdateSelectedItem()
=> SelectedItem.Value = RoomID.Value == null || subScreenSelectedItem == null
- ? Playlist.LastOrDefault()
+ ? Playlist.GetCurrentItem()
: subScreenSelectedItem.Value;
}
}