forked from lukas-walker/4d-holographic-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScrollablePagination.cs
More file actions
47 lines (43 loc) · 1.45 KB
/
Copy pathScrollablePagination.cs
File metadata and controls
47 lines (43 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.UI;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
/// <summary>
/// Example script of how to navigate a <see cref="Microsoft.MixedReality.Toolkit.UI.ScrollingObjectCollection"/> by pagination.
/// Allows the call to scroll pagination methods from the inspector.
/// </summary>
public class ScrollablePagination : MonoBehaviour
{
[SerializeField]
[Tooltip("The ScrollingObjectCollection to navigate")]
private ScrollingObjectCollection scrollView;
/// <summary>
/// The ScrollingObjectCollection to navigate.
/// </summary>
public ScrollingObjectCollection ScrollView
{
get
{
if (scrollView == null)
{
scrollView = GetComponent<ScrollingObjectCollection>();
}
return scrollView;
}
set
{
scrollView = value;
}
}
/// <summary>
/// Smoothly moves the scroll container a relative number of tiers of cells.
/// </summary>
public void ScrollByTier(int amount)
{
Debug.Assert(ScrollView != null, "Scroll view needs to be defined before using pagination.");
scrollView.MoveByTiers(amount);
}
}
}