/// Credit setchi (https://github.com/setchi) /// Sourced from - https://github.com/setchi/FancyScrollView using UnityEngine; namespace UnityEngine.UI.Extensions { public abstract class FancyScrollViewCell : MonoBehaviour where TContext : class, new() { /// /// Gets or sets the index of the data. /// /// The index of the data. public int Index { get; set; } = -1; /// /// Gets a value indicating whether this is visible. /// /// true if is visible; otherwise, false. public virtual bool IsVisible => gameObject.activeSelf; /// /// Gets the context. /// /// The context. protected TContext Context { get; private set; } /// /// Setup the context. /// /// Context. public virtual void SetupContext(TContext context) => Context = context; /// /// Sets the visible. /// /// If set to true visible. public virtual void SetVisible(bool visible) => gameObject.SetActive(visible); /// /// Updates the content. /// /// Item data. public abstract void UpdateContent(TItemData itemData); /// /// Updates the position. /// /// Position. public abstract void UpdatePosition(float position); } public abstract class FancyScrollViewCell : FancyScrollViewCell { public sealed override void SetupContext(FancyScrollViewNullContext context) => base.SetupContext(context); } }