示例#1
0
        public MapRenderable2D(LogicalMap2D logicalMap, ITexture tileset)
        {
            if (tileset == null)
            {
                throw new ArgumentNullException(nameof(tileset));
            }
            _logicalMap = logicalMap ?? throw new ArgumentNullException(nameof(logicalMap));
            var subImage = tileset.GetSubImageDetails(0);

            TileSize = subImage.Size;

            _underlay = AttachChild(new TileLayer(
                                        logicalMap,
                                        tileset,
                                        logicalMap.GetUnderlay,
                                        DrawLayer.Underlay,
                                        IconChangeType.Underlay));

            _overlay = AttachChild(new TileLayer(logicalMap,
                                                 tileset,
                                                 logicalMap.GetOverlay,
                                                 DrawLayer.Overlay,
                                                 IconChangeType.Overlay));

            _info = AttachChild(new InfoOverlay(logicalMap));

            var tileSize = tileset.GetSubImageDetails(0).Size;

            _annotations = AttachChild(new MapAnnotationLayer(logicalMap, tileSize));

            On <ToggleUnderlayEvent>(e => _underlay.IsActive = !_underlay.IsActive);
            On <ToggleOverlayEvent>(e => _overlay.IsActive   = !_overlay.IsActive);
        }
示例#2
0
        public MapRenderable2D(LogicalMap2D logicalMap, ITexture tileset)
        {
            On <ToggleUnderlayEvent>(e => _underlay.IsActive = !_underlay.IsActive);
            On <ToggleOverlayEvent>(e => _overlay.IsActive   = !_overlay.IsActive);

            _logicalMap = logicalMap;
            var subImage = tileset.GetSubImageDetails(0);

            TileSize = subImage.Size;

            _underlay = AttachChild(new TileLayer(
                                        logicalMap,
                                        tileset,
                                        logicalMap.GetUnderlay,
                                        DrawLayer.Underlay,
                                        IconChangeType.Underlay));

            _overlay = AttachChild(new TileLayer(logicalMap,
                                                 tileset,
                                                 logicalMap.GetOverlay,
                                                 DrawLayer.Overlay,
                                                 IconChangeType.Overlay));

            var tileSize = tileset.GetSubImageDetails(0).Size;

            _annotations = AttachChild(new MapAnnotationLayer(logicalMap, tileSize));
        }