Esempio n. 1
0
        /// <summary>
        /// This function adds a new record, resizing the scroller and calculating the sizes of all cells
        /// </summary>
        public void AddNewRow()
        {
            // first, clear out the cells in the scroller so the new text transforms will be reset
            scroller.ClearAll();

            // reset the scroller's position so that it is not outside of the new bounds
            scroller.ScrollPosition = 0;

            // second, reset the data's cell view sizes
            foreach (var item in _data)
            {
                item.cellSize = 0;
            }

            // now we can add the data row
            _data.Add(new Data()
            {
                cellSize = 0, someText = _data.Count.ToString() + " New Row Added!"
            });

            ResizeScroller();

            // optional: jump to the end of the scroller to see the new content
            scroller.JumpToDataIndex(_data.Count - 1, 1f, 1f);
        }
Esempio n. 2
0
        public void AddNewRow(DataChat.CellType cellType, string text)
        {
            // first, clear out the cells in the scroller so the new text transforms will be reset
            scroller.ClearAll();

            _oldScrollPosition = scroller.ScrollPosition;

            // reset the scroller's position so that it is not outside of the new bounds
            scroller.ScrollPosition = 0;

            // second, reset the data's cell view sizes
            for (var i = 1; i < _data.Count; i++)
            {
                _data[i].cellSize = 0;
            }

            // now we can add the data row
            _data.Add(new DataChat()
            {
                cellType = cellType,
                cellSize = 0,
                someText = text
            });

            ResizeScroller();

            // jump to the end of the scroller to see the new content.
            // once the jump is completed, reset the spacer's size
            scroller.JumpToDataIndex(_data.Count - 1, 1f, 1f, tweenType: EnhancedScroller.TweenType.easeInOutSine, tweenTime: 0.5f, jumpComplete: ResetSpacer);
        }
Esempio n. 3
0
        public void AddNewRow()
        {
            // first, clear out the cells in the scroller so the new text transforms will be reset
            scroller.ClearAll();

            // second, reset the data's cell view sizes
            foreach (var item in _data)
            {
                item.cellSize = 0;
            }

            // now we can add the data row
            _data.Add(new Data()
            {
                cellSize = 0, someText = "New Row Added!"
            });

            // capture the scroller dimensions so that we can reset them when we are done
            var rectTransform = scroller.GetComponent <RectTransform>();
            var size          = rectTransform.sizeDelta;

            // set the dimensions to the largest size possible to acommodate all the cells
            rectTransform.sizeDelta = new Vector2(size.x, float.MaxValue);

            // First Pass: reload the scroller so that it can populate the text UI elements in the cell view.
            // The content size fitter will determine how big the cells need to be on subsequent passes
            scroller.ReloadData();

            // reset the scroller size back to what it was originally
            rectTransform.sizeDelta = size;

            // set up our frame countdown so that we can reload the scroller on subsequent frames
            _reloadScrollerFrameCountLeft = 1;
        }
Esempio n. 4
0
        /// <summary>
        /// Populates the data with a small set of records
        /// </summary>
        public void ParticipantsListReceived(List <string> participantsList)
        {
            _data = new SmallList <DataParticipant>();

            foreach (string participantName in participantsList)
            {
                _data.Add(new DataParticipant()
                {
                    someText = participantName
                });
            }

            scroller.ClearAll();

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
Esempio n. 5
0
 public void Reset()
 {
     enhancedScroller.ClearAll();
     _data.Clear();
 }
 private void OnDisable()
 {
     scroller.ClearAll();
     currentIndexItem = 100;
     btnSelect.gameObject.SetActive(false);
 }
Esempio n. 7
0
 public void Reset()
 {
     myScroller.ClearAll();
     _data.Clear();
 }