示例#1
0
        public CompatibilityReport DetermineCompatibility(Map map)
        {
            List<CompatibilityNote> compatibilityNotes = new List<CompatibilityNote>();

            if (map.Layers.Count != 1)
            {
                compatibilityNotes.Add(new CompatibilityNote(CompatibilityLevel.None,
                    "The map must contain exactly one layer"));
            }

            bool mixedTileSheets = false;
            bool nullTiles = false;
            bool animationTiles = false;
            foreach (Layer layer in map.Layers)
            {
                for (int tileY = 0; tileY < layer.LayerHeight; tileY++)
                {
                    for (int tileX = 0; tileX < layer.LayerWidth; tileX++)
                    {
                        Tile tile = layer.Tiles[tileX, tileY];
                        if (tile == null)
                            nullTiles = true;
                        else if (tile is AnimatedTile)
                            animationTiles = true;

                        // no need to test further?
                        if (mixedTileSheets && nullTiles && animationTiles)
                            goto CompatibilityTestEnd;
                    }
                }
            }
            CompatibilityTestEnd: // label to shorten compatibility test

            if (mixedTileSheets)
                compatibilityNotes.Add(new CompatibilityNote(CompatibilityLevel.None, "Cannot have multiple tile sheets per layer"));

            if (nullTiles)
                compatibilityNotes.Add(new CompatibilityNote(CompatibilityLevel.Partial, "Null tiles will be converted to the zero tile index"));

            if (animationTiles)
                compatibilityNotes.Add(new CompatibilityNote(CompatibilityLevel.Partial, "Animated tiles will be converted to static tiles"));

            CompatibilityReport compatibilityReport = new CompatibilityReport(compatibilityNotes);
            return compatibilityReport;
        }
示例#2
0
        public CompatibilityReport DetermineCompatibility(xTile.Map map)
        {
            List<CompatibilityNote> compatibilityNotes = new List<CompatibilityNote>();

            if (map.TileSheets.Count != 1)
                compatibilityNotes.Add(
                    new CompatibilityNote(CompatibilityLevel.None, "Map must use exactly one tile sheet"));

            if (map.Layers.Count == 0)
                compatibilityNotes.Add(
                    new CompatibilityNote(CompatibilityLevel.None, "Map must have at least one layer"));

            if (map.Layers.Count > 8)
                compatibilityNotes.Add(
                    new CompatibilityNote(CompatibilityLevel.None, "Map must have no more than 8 layers"));

            xTile.Dimensions.Size layerSize = map.Layers[0].LayerSize;

            foreach (Layer layer in map.Layers)
                if (layer.LayerSize != layerSize)
                {
                    compatibilityNotes.Add(
                        new CompatibilityNote(CompatibilityLevel.None, "All layers must be of the same size"));
                    break;
                }

            xTile.Dimensions.Size tileSize = map.Layers[0].TileSize;
            foreach (Layer layer in map.Layers)
                if (layer.TileSize != tileSize)
                {
                    compatibilityNotes.Add
                        (new CompatibilityNote(CompatibilityLevel.None,
                            "All layers must share a common tile size dictated by the tile sheet"));
                    break;
                }

            string[] descriptionParagraphs = map.Description.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            if (descriptionParagraphs.Length > 4)
                compatibilityNotes.Add(new CompatibilityNote(CompatibilityLevel.None, "Map description should not exceed 4 paragraphs"));

            compatibilityNotes.Add(
                new CompatibilityNote(CompatibilityLevel.Partial, "Tile, layer and map attributes will not be stored"));

            compatibilityNotes.Add(
                new CompatibilityNote(CompatibilityLevel.Partial, "Auto-tiling definitions will not be stored"));

            compatibilityNotes.Add(
                new CompatibilityNote(CompatibilityLevel.Partial, "Brush definitions will not be stored"));

            CompatibilityReport compatibilityReport = new CompatibilityReport(compatibilityNotes);
            return compatibilityReport;
        }
示例#3
0
 public TbinFormat()
 {
     m_compatibilityResults = new CompatibilityReport();
     m_tbinSequence = "tBIN10".ToArray().Select(x => (byte)x).ToArray();
 }
        public FormatCompatibilityDialog(CompatibilityReport compatibilityReport)
        {
            InitializeComponent();

            m_compatibilityReport = compatibilityReport;
        }
示例#5
0
 internal TideFormat()
 {
     m_compatibilityResults = new CompatibilityReport();
 }