Пример #1
0
        private List <Map> OnLoadMaps(BotBitsClient botBits, ISignFormat signFormat, IPositionMapper positionMapper)
        {
            var maps   = new List <Map>();
            var blocks = Blocks.Of(botBits);

            for (var x = 1; x < blocks.Width - MapWidth; x++)
            {
                for (var y = 1; y < blocks.Height - MapHeight; y++)
                {
                    var block = blocks.At(x, y).Foreground.Block;

                    if (block.Type != ForegroundType.Sign)
                    {
                        continue;
                    }

                    MapData mapData;
                    if (!signFormat.TryGetMapData(block.Text, Room.Of(botBits).Owner, out mapData))
                    {
                        continue;
                    }

                    maps.Add(new Map(blocks, positionMapper.GetMapRectangle(new Point(x, y), MapWidth, MapHeight),
                                     mapData.Name, mapData.Creators));
                }
            }

            return(maps);
        }
Пример #2
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);
        }
Пример #3
0
        private List<Map> OnLoadMaps(BotBitsClient botBits, ISignFormat signFormat, IPositionMapper positionMapper)
        {
            var maps = new List<Map>();
            var blocks = Blocks.Of(botBits);

            for (var x = 1; x < blocks.Width - MapWidth; x++)
            {
                for (var y = 1; y < blocks.Height - MapHeight; y++)
                {
                    var block = blocks.At(x, y).Foreground.Block;

                    if (block.Type != ForegroundType.Sign)
                        continue;

                    MapData mapData;
                    if (!signFormat.TryGetMapData(block.Text, Room.Of(botBits).Owner, out mapData))
                        continue;

                    maps.Add(new Map(blocks, positionMapper.GetMapRectangle(new Point(x, y), MapWidth, MapHeight),
                        mapData.Name, mapData.Creators));
                }
            }

            return maps;
        }
Пример #4
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);
        }