public TiledMapLayerAnimatedModelContent(string layerName, TiledMapTilesetContent tileset)
     : base(layerName, tileset)
 {
     _animatedTilesetTiles = new List <TiledMapTilesetTileContent>();
     AnimatedTilesetTiles  = new ReadOnlyCollection <TiledMapTilesetTileContent>(_animatedTilesetTiles);
     Tileset = tileset;
 }
Beispiel #2
0
        private static string GetTilesetFilePath(string mapFilePath, TiledMapTilesetContent tileset)
        {
            var directoryName = Path.GetDirectoryName(mapFilePath);

            Debug.Assert(directoryName != null, "directoryName != null");

            var tilesetLocation = tileset.Source.Replace('/', Path.DirectorySeparatorChar);
            var tilesetFilePath = Path.Combine(directoryName, tilesetLocation);

            return(tilesetFilePath);
        }
Beispiel #3
0
        private void WriteTileset(ContentWriter writer, TiledMapTilesetContent tileset)
        {
            writer.Write(tileset.FirstGlobalIdentifier);

            if (!string.IsNullOrWhiteSpace(tileset.Source))
            {
                writer.Write(true);
                writer.WriteExternalReference(_contentItem.GetExternalReference <TiledMapTilesetContent>(tileset.Source));
            }
            else
            {
                writer.Write(false);
                TiledMapTilesetWriter.WriteTileset(writer, tileset, _contentItem);
            }
        }
        public static void WriteTileset(ContentWriter writer, TiledMapTilesetContent tileset, IExternalReferenceRepository externalReferenceRepository)
        {
            var externalReference = externalReferenceRepository.GetExternalReference <Texture2DContent>(tileset.Image.Source);

            writer.WriteExternalReference(externalReference);
            writer.Write(tileset.TileWidth);
            writer.Write(tileset.TileHeight);
            writer.Write(tileset.TileCount);
            writer.Write(tileset.Spacing);
            writer.Write(tileset.Margin);
            writer.Write(tileset.Columns);
            writer.Write(tileset.Tiles.Count);

            foreach (var tilesetTile in tileset.Tiles)
            {
                WriteTilesetTile(writer, tilesetTile);
            }

            writer.WriteTiledMapProperties(tileset.Properties);
        }
Beispiel #5
0
        private static void WriteTileset(ContentWriter output, TiledMapTilesetContent tileset)
        {
            output.Write(Path.ChangeExtension(tileset.Image.Source, null));
            output.Write(tileset.FirstGlobalIdentifier);
            output.Write(tileset.TileWidth);
            output.Write(tileset.TileHeight);
            output.Write(tileset.TileCount);
            output.Write(tileset.Spacing);
            output.Write(tileset.Margin);

            output.Write(tileset.Columns);

            output.Write(tileset.Tiles.Count);
            foreach (var tilesetTile in tileset.Tiles)
            {
                WriteTilesetTile(output, tilesetTile);
            }

            output.WriteTiledMapProperties(tileset.Properties);
        }
Beispiel #6
0
 public TiledMapLayerModelContent(string layerName, TiledMapTilesetContent tileset)
     : this(layerName, tileset.Image)
 {
 }
Beispiel #7
0
        private static TiledMapTilesetContent ImportTileset(string tilesetFilePath, XmlSerializer tilesetSerializer, TiledMapTilesetContent tileset)
        {
            TiledMapTilesetContent result;

            ContentLogger.Log($"Importing tileset '{tilesetFilePath}'");

            using (var file = new FileStream(tilesetFilePath, FileMode.Open))
            {
                var importedTileset = (TiledMapTilesetContent)tilesetSerializer.Deserialize(file);
                importedTileset.FirstGlobalIdentifier = tileset.FirstGlobalIdentifier;
                result = importedTileset;
            }

            ContentLogger.Log($"Imported tileset '{tilesetFilePath}'");

            return(result);
        }