Beispiel #1
0
        public void OnPointerDown(PointerEventData eventData)
        {
            _startY = this.transform.position.y;

            if (OnStart != null)
            {
                OnStart.Invoke(this);
            }
            Current = this;
        }
        /// <summary>
        /// This handler will be called any time a cell view is shown or hidden
        /// </summary>
        /// <param name="cellView">The cell view that was shown or hidden</param>
        private void CellViewVisibilityChanged(EnhancedScrollerCellView cellView)
        {
            // cast the cell view to our custom view
            CellView view = cellView as CellView;

            // if the cell is active, we set its data,
            // otherwise we will clear the image back to
            // its default state

            if (cellView.active)
            {
                view.SetData(_data[cellView.dataIndex]);
            }
            else
            {
                view.ClearImage();
            }
        }
Beispiel #3
0
        /// <summary>
        /// This handler will be called any time a cell view is shown or hidden
        /// </summary>
        /// <param name="cellView">The cell view that was shown or hidden</param>
        private void CellViewVisibilityChanged(SEUIContainerItem cellView)
        {
            // cast the cell view to our custom view
            CellView view = cellView as CellView;

            // if the cell is active, we set its data,
            // otherwise we will clear the image back to
            // its default state

            if (cellView.active)
            {
                view.UpdateDataView(_data[cellView.dataIndex]);
            }
            else
            {
                view.ClearImage();
            }
        }
        /// <summary>
        /// Gets the cell to be displayed. You can have numerous cell types, allowing variety in your list.
        /// Some examples of this would be headers, footers, and other grouping cells.
        /// </summary>
        /// <param name="scroller">The scroller requesting the cell</param>
        /// <param name="dataIndex">The index of the data that the scroller is requesting</param>
        /// <param name="cellIndex">The index of the list. This will likely be different from the dataIndex if the scroller is looping</param>
        /// <returns>The cell for the scroller to use</returns>
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            // first, we get a cell from the scroller by passing a prefab.
            // if the scroller finds one it can recycle it will do so, otherwise
            // it will create a new cell.
            CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView;

            // set the name of the game object to the cell's data index.
            // this is optional, but it helps up debug the objects in
            // the scene hierarchy.
            cellView.name = "Cell " + dataIndex.ToString();

            // In this example, we do not set the data here since the cell is not visibile yet. Use a coroutine
            // before the cell is visibile will result in errors, so we defer loading until the cell has
            // become visible. We can trap this in the cellViewVisibilityChanged delegate handled below

            // return the cell to the scroller
            return(cellView);
        }
Beispiel #5
0
 private void OnStart(CellView cellView)
 {
     _startY = cellView.transform.position.y;
 }