Show / Hide Table of Contents

Class FancyScrollView<TItemData, TContext>

スクロールビューを実装するための抽象基底クラス. 無限スクロールおよびスナップに対応しています. Context が不要な場合は 代わりに FancyScrollView<TItemData> を使用します.

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
FancyScrollView<TItemData, TContext>
FancyScrollRect<TItemData, TContext>
FancyScrollView<TItemData>
Namespace: FancyScrollView
Assembly: FancyScrollView.dll
Syntax
public abstract class FancyScrollView<TItemData, TContext> : MonoBehaviour where TContext : class, new()
Type Parameters
Name Description
TItemData

アイテムのデータ型.

TContext

Context の型.

Fields

cellContainer

セルの親要素となる Transform.

Declaration
[SerializeField]
protected Transform cellContainer
Field Value
Type Description
UnityEngine.Transform

cellInterval

セル同士の間隔.

Declaration
[SerializeField]
[Range(0.01F, 1F)]
protected float cellInterval
Field Value
Type Description
System.Single

currentPosition

現在のスクロール位置.

Declaration
protected float currentPosition
Field Value
Type Description
System.Single

initialized

初期化済みかどうか.

Declaration
protected bool initialized
Field Value
Type Description
System.Boolean

loop

セルを循環して配置させるどうか.

Declaration
[SerializeField]
protected bool loop
Field Value
Type Description
System.Boolean
Remarks

true にすると最後のセルの後に最初のセル, 最初のセルの前に最後のセルが並ぶようになります. 無限スクロールを実装する場合は true を指定します.

scrollOffset

スクロール位置の基準.

Declaration
[SerializeField]
[Range(0F, 1F)]
protected float scrollOffset
Field Value
Type Description
System.Single
Remarks

たとえば、 0.5 を指定してスクロール位置が 0 の場合, 中央に最初のセルが配置されます.

Properties

CellPrefab

セルの Prefab.

Declaration
protected abstract GameObject CellPrefab { get; }
Property Value
Type Description
UnityEngine.GameObject

Context

TContext のインスタンス. セルとスクロールビュー間で同じインスタンスが共有されます. 情報の受け渡しや状態の保持に使用します.

Declaration
protected TContext Context { get; }
Property Value
Type Description
TContext

ItemsSource

アイテム一覧のデータ.

Declaration
protected IList<TItemData> ItemsSource { get; set; }
Property Value
Type Description
System.Collections.Generic.IList<TItemData>

Methods

Initialize()

初期化を行います.

Declaration
protected virtual void Initialize()
Remarks

最初にセルが生成される直前に呼び出されます.

Refresh()

セルのレイアウトと表示内容を強制的に更新します.

Declaration
protected virtual void Refresh()

Relayout()

セルのレイアウトを強制的に更新します.

Declaration
protected virtual void Relayout()

UpdateContents(IList<TItemData>)

渡されたアイテム一覧に基づいて表示内容を更新します.

Declaration
protected virtual void UpdateContents(IList<TItemData> itemsSource)
Parameters
Type Name Description
System.Collections.Generic.IList<TItemData> itemsSource

アイテム一覧.

UpdatePosition(Single)

スクロール位置を更新します.

Declaration
protected virtual void UpdatePosition(float position)
Parameters
Type Name Description
System.Single position

スクロール位置.

Back to top Generated by DocFX