Class FancyGridView<TItemData, TContext>
グリッドレイアウトのスクロールビューを実装するための抽象基底クラス. 無限スクロールおよびスナップには対応していません. Context が不要な場合は 代わりに FancyGridView<TItemData> を使用します.
Inheritance
System.Object
    UnityEngine.Object
    UnityEngine.Component
    UnityEngine.Behaviour
    UnityEngine.MonoBehaviour
    FancyScrollView<TItemData[], TContext>
    FancyScrollRect<TItemData[], TContext>
    FancyGridView<TItemData, TContext>
      FancyGridView<TItemData>
  Inherited Members
Namespace: FancyScrollView
Assembly: FancyScrollView.dll
Syntax
public abstract class FancyGridView<TItemData, TContext> : FancyScrollRect<TItemData[], TContext> where TContext : class, IFancyGridViewContext, new()Type Parameters
| Name | Description | 
|---|---|
| TItemData | アイテムのデータ型. | 
| TContext | Context の型. | 
Fields
cellSize
セルのサイズ.
Declaration
[SerializeField]
protected Vector2 cellSizeField Value
| Type | Description | 
|---|---|
| UnityEngine.Vector2 | 
startAxisCellCount
最初にセルを配置する軸方向のセル数.
Declaration
[SerializeField]
protected int startAxisCellCountField Value
| Type | Description | 
|---|---|
| System.Int32 | 
startAxisSpacing
最初にセルを配置する軸方向のセル同士の余白.
Declaration
[SerializeField]
protected float startAxisSpacingField Value
| Type | Description | 
|---|---|
| System.Single | 
Properties
CellPrefab
セルのグループ Prefab.
Declaration
protected override sealed GameObject CellPrefab { get; }Property Value
| Type | Description | 
|---|---|
| UnityEngine.GameObject | 
Overrides
FancyScrollView.FancyScrollView<TItemData[], TContext>.CellPrefab
  Remarks
FancyGridView<TItemData, TContext> では, CellPrefab を最初にセルを配置する軸方向のセルコンテナとして使用します.
CellSize
Declaration
protected override float CellSize { get; }Property Value
| Type | Description | 
|---|---|
| System.Single | 
Overrides
FancyScrollView.FancyScrollRect<TItemData[], TContext>.CellSize
  
  
  
  DataCount
アイテムの総数.
Declaration
public int DataCount { get; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
Methods
Initialize()
Declaration
protected override void Initialize()Overrides
FancyScrollView.FancyScrollRect<TItemData[], TContext>.Initialize()
  
  
  
  JumpTo(Int32, Single)
指定したアイテムの位置までジャンプします.
Declaration
protected override void JumpTo(int itemIndex, float alignment = 0.5F)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | itemIndex | アイテムのインデックス. | 
| System.Single | alignment | ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾). | 
Overrides
FancyScrollView.FancyScrollRect<TItemData[], TContext>.JumpTo(System.Int32, System.Single)
  
  
  
  ScrollTo(Int32, Single, Ease, Single, Action)
指定したアイテムの位置まで移動します.
Declaration
protected override void ScrollTo(int itemIndex, float duration, Ease easing, float alignment = 0.5F, Action onComplete = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | itemIndex | アイテムのインデックス. | 
| System.Single | duration | 移動にかける秒数. | 
| Ease | easing | 移動に使用するイージング. | 
| System.Single | alignment | ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾). | 
| System.Action | onComplete | 移動が完了した際に呼び出されるコールバック. | 
Overrides
FancyScrollView.FancyScrollRect<TItemData[], TContext>.ScrollTo(System.Int32, System.Single, EasingCore.Ease, System.Single, System.Action)
  
  
  
  ScrollTo(Int32, Single, Single, Action)
指定したアイテムの位置まで移動します.
Declaration
protected override void ScrollTo(int itemIndex, float duration, float alignment = 0.5F, Action onComplete = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | itemIndex | アイテムのインデックス. | 
| System.Single | duration | 移動にかける秒数. | 
| System.Single | alignment | ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾). | 
| System.Action | onComplete | 移動が完了した際に呼び出されるコールバック. | 
Overrides
FancyScrollView.FancyScrollRect<TItemData[], TContext>.ScrollTo(System.Int32, System.Single, System.Single, System.Action)
  
  
  
  Setup<TGroup>(FancyCell<TItemData, TContext>)
セルテンプレートのセットアップを行います.
Declaration
protected virtual void Setup<TGroup>(FancyCell<TItemData, TContext> cellTemplate)
    where TGroup : FancyCell<TItemData[], TContext>Parameters
| Type | Name | Description | 
|---|---|---|
| FancyCell<TItemData, TContext> | cellTemplate | セルのテンプレート. | 
Type Parameters
| Name | Description | 
|---|---|
| TGroup | セルグループの型. | 
SetupCellTemplate()
最初にセルが生成される直前に呼び出されます. Setup<TGroup>(FancyCell<TItemData, TContext>) メソッドを使用してセルテンプレートのセットアップを行ってください.
Declaration
protected abstract void SetupCellTemplate()Examples
using UnityEngine;
using FancyScrollView;
public class MyGridView : FancyGridView<ItemData, Context>
{
    class CellGroup : DefaultCellGroup { }
    [SerializeField] Cell cellPrefab = default;
    protected override void SetupCellTemplate() => Setup<CellGroup>(cellPrefab);
}UpdateContents(IList<TItemData>)
渡されたアイテム一覧に基づいて表示内容を更新します.
Declaration
public virtual void UpdateContents(IList<TItemData> items)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IList<TItemData> | items | アイテム一覧. |