private void WriteLayer(ContentWriter writer, TiledMapLayerContent layer) { writer.Write((byte)layer.Type); writer.Write(layer.Name ?? string.Empty); writer.Write(layer.Visible); writer.Write(layer.Opacity); writer.Write(layer.OffsetX); writer.Write(layer.OffsetY); writer.WriteTiledMapProperties(layer.Properties); switch (layer.Type) { case TiledMapLayerType.ImageLayer: WriteImageLayer(writer, (TiledMapImageLayerContent)layer); break; case TiledMapLayerType.TileLayer: WriteTileLayer(writer, (TiledMapTileLayerContent)layer); break; case TiledMapLayerType.ObjectLayer: WriteObjectLayer(writer, (TiledMapObjectLayerContent)layer); break; case TiledMapLayerType.GroupLayer: WriteLayers(writer, ((TiledMapGroupLayerContent)layer).Layers); break; default: throw new ArgumentOutOfRangeException(nameof(layer.Type)); } }
private static void WriteLayer(ContentWriter output, TiledMapLayerContent layer) { output.Write((byte)layer.Type); output.Write(layer.Name ?? string.Empty); output.Write(layer.Visible); output.Write(layer.Opacity); output.Write(layer.OffsetX); output.Write(layer.OffsetY); output.WriteTiledMapProperties(layer.Properties); switch (layer.Type) { case TiledMapLayerType.ImageLayer: WriteImageLayer(output, (TiledMapImageLayerContent)layer); break; case TiledMapLayerType.TileLayer: WriteTileLayer(output, (TiledMapTileLayerContent)layer); break; case TiledMapLayerType.ObjectLayer: WriteObjectLayer(output, (TiledMapObjectLayerContent)layer); break; default: throw new ArgumentOutOfRangeException(nameof(layer.Type)); } if (layer.Type != TiledMapLayerType.ObjectLayer) { WriteModels(output, layer.Models); } }