/// <summary> Updates the data at the specified index inside the grid. </summary> /// <param name="index"> Zero-based index of the. </param> /// <param name="data"> The grid data to store. </param> /// <param name="position"> The coordinate of the original GridItem where the data was retrieved /// from. </param> /// <param name="chunk"></param> private void UpdateData(Array2DIndex index, GridItem data, GridCoordinate position, Chunk chunk) { var newData = new SliceUnitData <T>(chunk, position, data, default(T)); var rawIndex = _visibleGridItems.CalculateRawArrayIndex(index); var oldData = _visibleGridItems.Data[rawIndex]; _visibleGridItems.Data[rawIndex] = newData; DataChanged?.Invoke(oldData, ref _visibleGridItems.Data[rawIndex]); MarkChunkChanged(oldData.Chunk, chunk); }
/// <summary> Updates the data at the specified index inside the grid. </summary> /// <param name="index"> Zero-based index of the. </param> /// <param name="data"> The grid data to store. </param> /// <param name="position"> The coordinate of the original GridItem where the data was retrieved /// from. </param> /// <param name="chunk"></param> /// <param name="changeType"></param> private void UpdateData(Array2DIndex index, GridItem data, GridCoordinate position, Chunk chunk, GridItemPropertyChange changeType) { var newData = new SliceUnitData <T>(chunk, position, data, default(T)); var rawIndex = _visibleGridItems.CalculateRawArrayIndex(index); ref var slot = ref _visibleGridItems.Data[rawIndex];