void Update() { bool selectionChanged = false; if (Input.GetKeyDown(KeyCode.UpArrow) && _selectedIndex >= numberOfCellsPerRow) { // the up arrow was used, so we move the selected index up _selectedIndex = Mathf.Clamp(_selectedIndex - numberOfCellsPerRow, 0, _data.Count - 1); selectionChanged = true; } else if (Input.GetKeyDown(KeyCode.DownArrow) && _selectedIndex < _data.Count - numberOfCellsPerRow) { // the down arrow was used, so we move the selected index down _selectedIndex = Mathf.Clamp(_selectedIndex + numberOfCellsPerRow, 0, _data.Count - 1); selectionChanged = true; } else if (Input.GetKeyDown(KeyCode.LeftArrow)) { // the down arrow was used, so we move the selected index down _selectedIndex = Mathf.Clamp(_selectedIndex - 1, 0, _data.Count - 1); selectionChanged = true; } else if (Input.GetKeyDown(KeyCode.RightArrow)) { // the down arrow was used, so we move the selected index down _selectedIndex = Mathf.Clamp(_selectedIndex + 1, 0, _data.Count - 1); selectionChanged = true; } if (selectionChanged) { // the selected index was changed, so we update the underlying data for (var i = 0; i < _data.Count; i++) { _data[i].isSelected = i == _selectedIndex; } // refresh the visible cell views to update the selection highlight scroller.RefreshActiveCellViews(); var rowIndex = (_selectedIndex / numberOfCellsPerRow); if (rowIndex >= scroller.EndCellViewIndex) { // the selected index is at the bottom or beyond, so we need to scroll down. // note that we set the scroll offset to 1 (the end of the scroller) // and also set the cell offset to 1 so that the entire last cell is visible. scroller.JumpToDataIndex(rowIndex, 1.0f, 1.0f); } else if (rowIndex <= scroller.StartCellViewIndex) { // the selected index is at the top or beyond, so we need to scroll up. // note that we set the scroll offset to 0 (the start of the scroller) // and also set the cell offset to 0 so that the entire first cell is visible. scroller.JumpToDataIndex(rowIndex, 0.0f, 0.0f); } } }
/// <summary> /// спрятать окно, очищаем все списки /// </summary> /// <param name="callback"></param> public override void HideWindow(Action callback) { base.HideWindow(callback); foreach (var selectWindowContainer in scroller.GetComponentsInChildren <SelectWindowContainer>()) { selectWindowContainer.ClearView(); } scroller.RefreshActiveCellViews(); }
private void GraphViewPicked(long option) { GraphView newView = (GraphView)(int)option; if (_graphView != newView) { _graphView = newView; Initialize(); scroller.RefreshActiveCellViews(); } }
private void UpdateDetailScrollers(float normalizedScrollPosition) { if (HScrollbar.value != normalizedScrollPosition) { HScrollbar.value = normalizedScrollPosition; } foreach (var data in _data) { data.normalizedScrollPosition = normalizedScrollPosition; } masterScroller.RefreshActiveCellViews(); }
private void Update() { // update the data and refresh the active cells if (Input.GetKeyDown(KeyCode.R)) { // set up some new data for cells zero through five _data[0].someText = "This cell was updated"; _data[1].someText = "---"; _data[2].someText = "---"; _data[3].someText = "---"; _data[4].someText = "---"; _data[5].someText = "This cell was also updated"; // refresh the active cells scroller.RefreshActiveCellViews(); } }
public virtual ScrollerCtrlBase RefershData() { scroller.RefreshActiveCellViews(); return(this); }