public string Update(List <List <List <int> > > from, int toX, int toY) { var scope = new PickedScope( Width, Height, toX, toY, toX + from[0][0].Count() - 1, toY + from[0].Count() - 1); for (int ly = 0; ly < from.Count(); ly++) { for (int y = 0; y < from[ly].Count(); y++) { for (int x = 0; x < from[ly][y].Count(); x++) { if (from[ly][y][x] != -1) { if (scope.X0 + x >= Width || scope.Y0 + y >= Height) { continue; } _jsonData.Update( GetIndex(ly, scope.X0 + x, scope.Y0 + y), from[ly][y][x]); } } } } return(_jsonData.Serialize()); }
public void Reset(int x0, int y0, int x1, int y1) { _usedScope = new PickedScope(Width, Height, x0, y0, x1, y1); _layersUsedTiles = new LayersUsedTilesValue( GetUsedTilesValue(_layersCounts, _usedScope)); }
private List <List <List <int> > > GetUsedTilesValue(int layersCounts, PickedScope scope) { var result = new List <List <List <int> > > { }; for (int ly = 0; ly < layersCounts; ly++) { var layerData = new List <List <int> > { }; for (int h = 0; h <= scope.IncreasedHeight; h++) { var hData = new List <int> { }; for (int w = 0; w <= scope.IncreasedWidth; w++) { hData.Add(GetValue(ly, scope.X0 + w, scope.Y0 + h)); } layerData.Add(hData); } result.Add(layerData); } return(result); }