1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 14:03:07 +08:00

Generic type instead of raw object?

This commit is contained in:
Dean Herbert 2025-01-10 20:32:07 +09:00
parent 6fbab1bbce
commit cf55fe16ab
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ using osuTK.Graphics;
namespace osu.Game.Screens.SelectV2
{
[Cached]
public partial class BeatmapCarouselV2 : Carousel
public partial class BeatmapCarouselV2 : Carousel<BeatmapInfo>
{
private IBindableList<BeatmapSetInfo> detachedBeatmaps = null!;
@ -60,7 +60,7 @@ namespace osu.Game.Screens.SelectV2
return drawable;
}
protected override CarouselItem CreateCarouselItemForModel(object model) => new BeatmapCarouselItem(model);
protected override CarouselItem CreateCarouselItemForModel(BeatmapInfo model) => new BeatmapCarouselItem(model);
private void beatmapSetsChanged(object? beatmaps, NotifyCollectionChangedEventArgs changed)
{

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.SelectV2
/// A highly efficient vertical list display that is used primarily for the song select screen,
/// but flexible enough to be used for other use cases.
/// </summary>
public abstract partial class Carousel : CompositeDrawable
public abstract partial class Carousel<T> : CompositeDrawable
{
/// <summary>
/// A collection of filters which should be run each time a <see cref="QueueFilter"/> is executed.
@ -80,7 +80,7 @@ namespace osu.Game.Screens.SelectV2
/// <remarks>
/// Note that an <see cref="ICarouselFilter"/> may add new items which are displayed but not tracked in this list.
/// </remarks>
protected readonly BindableList<object> Items = new BindableList<object>();
protected readonly BindableList<T> Items = new BindableList<T>();
/// <summary>
/// The currently selected model.
@ -148,7 +148,7 @@ namespace osu.Game.Screens.SelectV2
/// </summary>
/// <param name="model">The model.</param>
/// <returns>A <see cref="CarouselItem"/> representing the model.</returns>
protected abstract CarouselItem CreateCarouselItemForModel(object model);
protected abstract CarouselItem CreateCarouselItemForModel(T model);
#region Filtering and display preparation