private float _LastScrollRectPos; //上次记录的ScrollRectPos的位置 protected override void OnSafeInit() { base.OnSafeInit(); if (_ScrollRect == null) { _ScrollRect = GetComponent <ScrollRect>(); } _ScrollRectTrans = _ScrollRect.transform.GetComponent <RectTransform>(); _Pool = new GNewPrivatePool <GDragablePageItem>(16); _Items = new List <GDragablePageItem>(); _IsDraging = false; _IsStopMove = true; _TimeInterval = 0; _TotalTime = 0; _StartMoveTime = 0; _ItemCount = 0; _CurItemIndex = 0; _StartListenTime = 0; _ListenTimeInterval = 0.1f; _LastScrollRectPos = 0; _ScrollRect.onValueChanged.AddListener(OnScorllRectChanged); GNewUITools.SetVisible(_CellItem, false); //测试用 //SetPageItemCount(6); //_TimeInterval = 3; }
protected virtual void OnInit() { if (templateRect == null) { if (CacheTransform.childCount > 0) { templateRect = CacheTransform.GetChild(0) as RectTransform; } } if (templateRect != null) { UGUITools.SetVisible(templateRect, false); } if (rowCount < 1) { rowCount = 1; } if (columnCount < 1) { columnCount = 1; } if (!NoScroll) { ScrollRect = UGUITools.SecureComponetInParent <ScrollRect>(CacheRectTransform); } if (ScrollRect != null) { ScrollRect.horizontal = !IsVertical; ScrollRect.vertical = IsVertical; } _Pool = new GNewPrivatePool <LayoutItem>(PoolSize); }
protected override void OnSafeInit() { base.OnSafeInit(); //Transform t = transform; if (_ScrollRect == null) { _ScrollRect = GetComponent <ScrollRect>(); } if (_ScrollRect != null) { _Content = _ScrollRect.content; } else { _Content = RectTrans; } _CellPool = new GNewPrivatePool <GListItem>(); _CellPool.SetSize(10); if (CellTemplate != null) { CellTemplate.localScale = Vector3.zero; } else { Debug.LogError("GNewTable: CellTemplate is Null!!!"); } _ViewItems = new List <GListItem>(); }
protected override void OnSafeInit() { base.OnSafeInit(); if (!noScroll) { //_ScrollRect = GetComponentInParent<ScrollRect>(true); _ScrollRect = GNewUITools.SecureComponetInParent <ScrollRect>(RectTrans); } if (_ScrollRect != null) { _ScrollRect.horizontal = !IsVertical; _ScrollRect.vertical = IsVertical; } _Pool = new GNewPrivatePool <GListItem>(PoolSize); }