本文整理汇总了C#中UIScrollView.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UIScrollView.GetComponent方法的具体用法?C# UIScrollView.GetComponent怎么用?C# UIScrollView.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIScrollView
的用法示例。
在下文中一共展示了UIScrollView.GetComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitGrid
/// <summary>
/// Cache the scroll view and return 'false' if the scroll view is not found.
/// </summary>
public void InitGrid() {
mTrans = transform;
mPanel = NGUITools.FindInParents<UIPanel>(gameObject);
mScroll = mPanel.GetComponent<UIScrollView>();
if (mScroll != null) {
mScroll.GetComponent<UIPanel>().onClipMove = OnMove;
}
mChildren.Clear();
for (int i = 0; i < mTrans.childCount; ++i)
mChildren.Add(mTrans.GetChild(i));
// Sort the list of children so that they are in order
mChildren.Sort(UIGrid.SortByName);
if (mScroll == null) return;
if (mScroll.movement == UIScrollView.Movement.Horizontal) mHorizontal = true;
else if (mScroll.movement == UIScrollView.Movement.Vertical) mHorizontal = false;
WrapContent();
}
示例2: leftShiftScrollView
public static void leftShiftScrollView(UIScrollView scrollView, UIGrid grid)
{
float weight = grid.cellWidth;
Vector3 currentPosition = scrollView.transform.localPosition;
float maxWeight = (grid.GetChildList().Count) * grid.cellWidth / 2;
scrollView.transform.localPosition = new Vector3(currentPosition.x - weight, currentPosition.y, currentPosition.z);
scrollView.GetComponent<UIPanel>().clipOffset = new Vector3(currentPosition.x - weight, currentPosition.y, currentPosition.z);
}
示例3: Start
// Use this for initialization
void Start ()
{
_swipeState = SwipeState.None;
_isFirstTouch = true;
_uiScrollView = GetComponentInChildren<UIScrollView>();
if (null == _uiScrollView)
{
throw new MissingComponentException("TestSwipeScripts.Start - can't get UIScrollView component for _uiScrollView");
}
_startingMomentum = _uiScrollView.momentumAmount;
_uiScrollView.panel.clipping = UIDrawCall.Clipping.None;
_panel = _uiScrollView.GetComponent<UIPanel>();
if (null == _panel)
{
throw new MissingComponentException("TestSwipeScripts.Start - can't get UIPanel component for _panel");
}
DynamicScrollView2 dynamicScrollView = FindObjectOfType<DynamicScrollView2>();
if (null == dynamicScrollView)
{
throw new NullReferenceException("TestSwipeScripts.Start - can't find DynamicScrollView object");
}
_thresholdDistanceToCloseCard = dynamicScrollView.closeDetailCardThresholdHorizontal;
_thresholdDistanceVerticalToCloseCard = dynamicScrollView.closeDetailCardThreshold;
ScrollViewContainer = NGUITools.FindInParents<UIWidget>(_uiScrollView.transform);
if (null == ScrollViewContainer)
{
throw new MissingComponentException("TestSwipeScripts.Start - can't get UIWidget component for _scrollViewContainer");
}
_currentScale = Vector3.one;
_previousMovementState = UIScrollView.Movement.Custom;
}