Show / Hide Table of Contents

Class Scroller

スクロール位置の制御を行うコンポーネント.

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
UnityEngine.EventSystems.UIBehaviour
Scroller
Implements
UnityEngine.EventSystems.IPointerUpHandler
UnityEngine.EventSystems.IPointerDownHandler
UnityEngine.EventSystems.IBeginDragHandler
UnityEngine.EventSystems.IEndDragHandler
UnityEngine.EventSystems.IDragHandler
UnityEngine.EventSystems.IScrollHandler
UnityEngine.EventSystems.IEventSystemHandler
Namespace: FancyScrollView
Assembly: FancyScrollView.dll
Syntax
public class Scroller : UIBehaviour, IPointerUpHandler, IPointerDownHandler, IBeginDragHandler, IEndDragHandler, IDragHandler, IScrollHandler, IEventSystemHandler

Properties

DecelerationRate

スクロールの減速率. Inertia が true の場合のみ有効です.

Declaration
public float DecelerationRate { get; set; }
Property Value
Type Description
System.Single

Draggable

Drag 入力を受付けるかどうか.

Declaration
public bool Draggable { get; set; }
Property Value
Type Description
System.Boolean

Elasticity

コンテンツがスクロール範囲を越えて移動するときに使用する弾力性の量.

Declaration
public float Elasticity { get; set; }
Property Value
Type Description
System.Single

Inertia

慣性を使用するかどうか. true を指定すると慣性が有効に, false を指定すると慣性が無効になります.

Declaration
public bool Inertia { get; set; }
Property Value
Type Description
System.Boolean

MovementType

コンテンツがスクロール範囲を越えて移動するときに使用する挙動.

Declaration
public MovementType MovementType { get; set; }
Property Value
Type Description
MovementType

Position

現在のスクロール位置.

Declaration
public float Position { get; set; }
Property Value
Type Description
System.Single

Scrollbar

スクロールバーのオブジェクト.

Declaration
public Scrollbar Scrollbar { get; }
Property Value
Type Description
UnityEngine.UI.Scrollbar

ScrollDirection

スクロール方向.

Declaration
public ScrollDirection ScrollDirection { get; }
Property Value
Type Description
ScrollDirection

ScrollSensitivity

ViewportSize の端から端まで Drag したときのスクロール位置の変化量.

Declaration
public float ScrollSensitivity { get; set; }
Property Value
Type Description
System.Single

SnapEnabled

true ならスナップし, falseならスナップしません.

Declaration
public bool SnapEnabled { get; set; }
Property Value
Type Description
System.Boolean
Remarks

スナップを有効にすると, 慣性でスクロールが止まる直前に最寄りのセルへ移動します.

ViewportSize

ビューポートのサイズ.

Declaration
public float ViewportSize { get; }
Property Value
Type Description
System.Single

Methods

GetMovementDirection(Int32, Int32)

sourceIndex から destIndex に移動する際の移動方向を返します. スクロール範囲が無制限に設定されている場合は, 最短距離の移動方向を返します.

Declaration
public MovementDirection GetMovementDirection(int sourceIndex, int destIndex)
Parameters
Type Name Description
System.Int32 sourceIndex

移動元のインデックス.

System.Int32 destIndex

移動先のインデックス.

Returns
Type Description
MovementDirection

JumpTo(Int32)

指定したインデックスの位置までジャンプします.

Declaration
public void JumpTo(int index)
Parameters
Type Name Description
System.Int32 index

アイテムのインデックス.

OnSelectionChanged(Action<Int32>)

選択位置が変化したときのコールバックを設定します.

Declaration
public void OnSelectionChanged(Action<int> callback)
Parameters
Type Name Description
System.Action<System.Int32> callback

選択位置が変化したときのコールバック.

OnValueChanged(Action<Single>)

スクロール位置が変化したときのコールバックを設定します.

Declaration
public void OnValueChanged(Action<float> callback)
Parameters
Type Name Description
System.Action<System.Single> callback

スクロール位置が変化したときのコールバック.

ScrollTo(Single, Single, Ease, Action)

指定した位置まで移動します.

Declaration
public void ScrollTo(float position, float duration, Ease easing, Action onComplete = null)
Parameters
Type Name Description
System.Single position

スクロール位置. 0f ~ totalCount - 1f の範囲.

System.Single duration

移動にかける秒数.

Ease easing

移動に使用するイージング.

System.Action onComplete

移動が完了した際に呼び出されるコールバック.

ScrollTo(Single, Single, EasingFunction, Action)

指定した位置まで移動します.

Declaration
public void ScrollTo(float position, float duration, EasingFunction easingFunction, Action onComplete = null)
Parameters
Type Name Description
System.Single position

スクロール位置. 0f ~ totalCount - 1f の範囲.

System.Single duration

移動にかける秒数.

EasingFunction easingFunction

移動に使用するイージング関数.

System.Action onComplete

移動が完了した際に呼び出されるコールバック.

ScrollTo(Single, Single, Action)

指定した位置まで移動します.

Declaration
public void ScrollTo(float position, float duration, Action onComplete = null)
Parameters
Type Name Description
System.Single position

スクロール位置. 0f ~ totalCount - 1f の範囲.

System.Single duration

移動にかける秒数.

System.Action onComplete

移動が完了した際に呼び出されるコールバック.

SetTotalCount(Int32)

アイテムの総数を設定します.

Declaration
public void SetTotalCount(int totalCount)
Parameters
Type Name Description
System.Int32 totalCount

アイテムの総数.

Remarks

totalCount を元に最大スクロール位置を計算します.

Start()

Declaration
protected override void Start()
Overrides
UnityEngine.EventSystems.UIBehaviour.Start()

Explicit Interface Implementations

IBeginDragHandler.OnBeginDrag(PointerEventData)

Declaration
void IBeginDragHandler.OnBeginDrag(PointerEventData eventData)
Parameters
Type Name Description
UnityEngine.EventSystems.PointerEventData eventData

IDragHandler.OnDrag(PointerEventData)

Declaration
void IDragHandler.OnDrag(PointerEventData eventData)
Parameters
Type Name Description
UnityEngine.EventSystems.PointerEventData eventData

IEndDragHandler.OnEndDrag(PointerEventData)

Declaration
void IEndDragHandler.OnEndDrag(PointerEventData eventData)
Parameters
Type Name Description
UnityEngine.EventSystems.PointerEventData eventData

IPointerDownHandler.OnPointerDown(PointerEventData)

Declaration
void IPointerDownHandler.OnPointerDown(PointerEventData eventData)
Parameters
Type Name Description
UnityEngine.EventSystems.PointerEventData eventData

IPointerUpHandler.OnPointerUp(PointerEventData)

Declaration
void IPointerUpHandler.OnPointerUp(PointerEventData eventData)
Parameters
Type Name Description
UnityEngine.EventSystems.PointerEventData eventData

IScrollHandler.OnScroll(PointerEventData)

Declaration
void IScrollHandler.OnScroll(PointerEventData eventData)
Parameters
Type Name Description
UnityEngine.EventSystems.PointerEventData eventData

Implements

UnityEngine.EventSystems.IPointerUpHandler
UnityEngine.EventSystems.IPointerDownHandler
UnityEngine.EventSystems.IBeginDragHandler
UnityEngine.EventSystems.IEndDragHandler
UnityEngine.EventSystems.IDragHandler
UnityEngine.EventSystems.IScrollHandler
UnityEngine.EventSystems.IEventSystemHandler
Back to top Generated by DocFX