Exemplo n.º 1
0
        /// <summary>
        /// Fired by the ScrollRect
        /// </summary>
        /// <param name="data"></param>
        public void OnEndDrag(PointerEventData data)
        {
            // no longer dragging
            _dragging = false;

            if (_pullToRefresh)
            {
                // we reached the scroll pull down threshold, so now we insert new data

                for (var i = 0; i < 3; i++)
                {
                    _data.Insert(new Data()
                    {
                        someText = "Brand New Data " + i.ToString() + "!!!"
                    }, 0);
                }

                // reload the scroller to show the new data
                scroller.ReloadData();

                // take off the refresh now that it is handled
                _pullToRefresh = false;

                // hide the release text if the scroller is down beyond the threshold
                releaseToRefreshText.gameObject.SetActive(false);
            }
        }