mirror of
https://github.com/ppy/osu.git
synced 2025-02-08 02:52:59 +08:00
Move Selected
status to drawables
Basically, I don't want bindables in `CarouselItem`. It means there needs to be a bind-unbind process on pooling. By moving these to the drawable and just updating every frame, we can simplify things a lot.
This commit is contained in:
parent
beaadfa1fa
commit
c67c0a7fc0
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.SelectV2
|
namespace osu.Game.Screens.SelectV2
|
||||||
{
|
{
|
||||||
@ -10,9 +9,9 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
/// Represents a single display item for display in a <see cref="Carousel{T}"/>.
|
/// Represents a single display item for display in a <see cref="Carousel{T}"/>.
|
||||||
/// This is used to house information related to the attached model that helps with display and tracking.
|
/// This is used to house information related to the attached model that helps with display and tracking.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class CarouselItem : IComparable<CarouselItem>
|
public sealed class CarouselItem : IComparable<CarouselItem>
|
||||||
{
|
{
|
||||||
public readonly BindableBool Selected = new BindableBool();
|
public const float DEFAULT_HEIGHT = 40;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The model this item is representing.
|
/// The model this item is representing.
|
||||||
@ -20,16 +19,27 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
public readonly object Model;
|
public readonly object Model;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current Y position in the carousel. This is managed by <see cref="Carousel{T}"/> and should not be set manually.
|
/// The current Y position in the carousel.
|
||||||
|
/// This is managed by <see cref="Carousel{T}"/> and should not be set manually.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double CarouselYPosition { get; set; }
|
public double CarouselYPosition { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The height this item will take when displayed.
|
/// The height this item will take when displayed. Defaults to <see cref="DEFAULT_HEIGHT"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract float DrawHeight { get; }
|
public float DrawHeight { get; set; } = DEFAULT_HEIGHT;
|
||||||
|
|
||||||
protected CarouselItem(object model)
|
/// <summary>
|
||||||
|
/// Whether this item should be a valid target for user group selection hotkeys.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsGroupSelectionTarget { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this item is visible or collapsed (hidden).
|
||||||
|
/// </summary>
|
||||||
|
public bool IsVisible { get; set; } = true;
|
||||||
|
|
||||||
|
public CarouselItem(object model)
|
||||||
{
|
{
|
||||||
Model = model;
|
Model = model;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user