Пример #1
0
        public MapSpot(int id, Blocks blocks, int width, int height, ISignFormat signFormat)
        {
            Id = id;
            Width = width;
            Height = height;

            var spotWidth = Width + 4;
            var spotHeight = Height + 4;
            var mapsInRow = (blocks.Width - 2)/spotWidth;
            var x = spotWidth*(id%mapsInRow);
            var y = spotHeight*(id/mapsInRow);

            SignPoint = new Point(x + 2, y + 2);
            MapPoint = new Point(x + 3, y + 3);

            var block = blocks.At(SignPoint).Foreground.Block;
            if (block.Type != ForegroundType.Sign)
                return;

            MapData mapData;
            if (!signFormat.TryGetMapData(block.Text, "", out mapData))
                return;
            Map = new Map(blocks, new Rectangle(MapPoint.X, MapPoint.Y, Width, Height), mapData.Name, mapData.Creators);
        }
Пример #2
0
 public void LoadMap(Map map)
 {
     this.Map = map;
 }
Пример #3
0
        /// <summary>
        ///     Adds the map.
        /// </summary>
        /// <param name="blocks">The blocks.</param>
        /// <param name="map">The map.</param>
        public void AddMap(Blocks blocks, Map map)
        {
            Map = map;

            map.BuildAt(blocks, MapPoint);
            var text = $"{map.Name}\\n================\\n{map.Creators}";
            blocks.Place(SignPoint.X, SignPoint.Y, Foreground.Sign.Block, text);
        }
Пример #4
0
 public void LoadGenerator(IMapGenerator generator,int seed)
 {
     Map = new Map(generator,seed);
     //offsetX = offsetY = 0;
     UpdateQueue();
 }