private void changePage() { DataTable aTable = _baseData.Table.Clone(); for (int i = (currPage - 1) * pageSize; i < pageSize * currPage && i < _baseData.Count; i++) { aTable.ImportRow(_baseData[i].Row); } base.DataSource = aTable; if (onPageChange != null) { onPageChange.Invoke(this, new PropertyChangedEventArgs("currPage")); } }
protected virtual void RaisePagingEvent(PagingEventArgs args) => PagingEvent?.Invoke(this, args);
private void LateUpdate() { if (!m_Content) { return; } EnsureLayoutHasRebuilt(); UpdateBounds(); float deltaTime = Time.unscaledDeltaTime; Vector2 offset = CalculateOffset(m_CurrentContentBounds, Vector2.zero); if (!m_Dragging && (offset != Vector2.zero || m_Velocity != Vector2.zero)) { Vector2 position = m_Content.anchoredPosition; for (int axis = 0; axis < 2; ++axis) { if (Math.Abs(offset[axis]) > EPSILON) { float speed = m_Velocity[axis]; position[axis] = Mathf.SmoothDamp(m_Content.anchoredPosition[axis], m_Content.anchoredPosition[axis] + offset[axis], ref speed, m_Elasticity, Mathf.Infinity, deltaTime); m_Velocity[axis] = speed; } else if (m_Inertia) { m_Velocity[axis] *= Mathf.Pow(m_DecelerationRate, deltaTime); if (Mathf.Abs(m_Velocity[axis]) < 1) { m_Velocity[axis] = 0; } position[axis] += m_Velocity[axis] * deltaTime; } else { m_Velocity[axis] = 0; } } if (m_Velocity != Vector2.zero) { SetContentAnchoredPosition(position); } } if (m_Dragging && m_Inertia) { Vector3 newVelocity = (m_Content.anchoredPosition - m_PrevPosition) / deltaTime; m_Velocity = Vector3.Lerp(m_Velocity, newVelocity, deltaTime * 10); } if (m_Dragging && m_Velocity != Vector2.zero) { JudgementIndex(offset); } if (!m_Dragging && m_PrevContentIndex != m_ContentIndex) { m_OnValueChanged.Invoke(m_ContentIndex); m_PrevContentIndex = m_ContentIndex; } if (m_ViewBounds != m_PrevViewBounds || m_ContentBounds != m_PrevContentBounds || m_ContentBounds != m_PrevCurrentContentBounds || m_Content.anchoredPosition != m_PrevPosition) { UpdatePrevData(); } }