2017-08-02 17:21:45 +08:00
|
|
|
|
/// Credit setchi (https://github.com/setchi)
|
|
|
|
|
/// Sourced from - https://github.com/setchi/FancyScrollView
|
|
|
|
|
|
|
|
|
|
namespace UnityEngine.UI.Extensions
|
|
|
|
|
{
|
2018-12-31 23:16:28 +08:00
|
|
|
|
public abstract class FancyScrollViewCell<TData, TContext> : MonoBehaviour where TContext : class
|
2017-08-02 17:21:45 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// Gets or sets the index of the data.
|
2017-08-02 17:21:45 +08:00
|
|
|
|
/// </summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// <value>The index of the data.</value>
|
|
|
|
|
public int DataIndex { get; set; }
|
2017-08-02 17:21:45 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// Gets a value indicating whether this <see cref="T:FancyScrollView.FancyScrollViewCell`2"/> is visible.
|
2017-08-02 17:21:45 +08:00
|
|
|
|
/// </summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// <value><c>true</c> if is visible; otherwise, <c>false</c>.</value>
|
|
|
|
|
public virtual bool IsVisible { get { return gameObject.activeSelf; } }
|
2017-08-02 17:21:45 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// Gets the context.
|
2017-08-02 17:21:45 +08:00
|
|
|
|
/// </summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// <value>The context.</value>
|
|
|
|
|
protected TContext Context { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sets the context.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="context">Context.</param>
|
|
|
|
|
public virtual void SetContext(TContext context)
|
2017-08-02 17:21:45 +08:00
|
|
|
|
{
|
2018-12-31 23:16:28 +08:00
|
|
|
|
Context = context;
|
2017-08-02 17:21:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// Sets the visible.
|
2017-08-02 17:21:45 +08:00
|
|
|
|
/// </summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// <param name="visible">If set to <c>true</c> visible.</param>
|
2017-08-02 17:21:45 +08:00
|
|
|
|
public virtual void SetVisible(bool visible)
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(visible);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// Updates the content.
|
2017-08-02 17:21:45 +08:00
|
|
|
|
/// </summary>
|
2018-12-31 23:16:28 +08:00
|
|
|
|
/// <param name="itemData">Item data.</param>
|
|
|
|
|
public virtual void UpdateContent(TData itemData)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Updates the position.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="position">Position.</param>
|
|
|
|
|
public virtual void UpdatePosition(float position)
|
|
|
|
|
{
|
|
|
|
|
}
|
2017-08-02 17:21:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-31 23:16:28 +08:00
|
|
|
|
public abstract class FancyScrollViewCell<TData> : FancyScrollViewCell<TData, FancyScrollViewNullContext>
|
2017-08-02 17:21:45 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|