public InfoOverlay(LogicalMap2D logicalMap) { _logicalMap = logicalMap ?? throw new ArgumentNullException(nameof(logicalMap)); // 1 tile padding all around so we don't have to worry about edge conditions in the shader _tiles = new byte[Width * Height]; _logicalMap.Dirty += (sender, args) => { if (args.Type != IconChangeType.Trigger) { return; } int index = _logicalMap.Index(args.X, args.Y); var zone = _logicalMap.GetZone(index); var triggers = zone?.Trigger ?? 0; _tiles[Index(args.X, args.Y)] = BuildTile(triggers); BufferDirty = true; }; On <BeginFrameEvent>(_ => _flags = 0); On <CursorModeEvent>(e => _flags |= e.Mode switch { CursorMode.Examine => InfoOverlayFlags.VerbExamine, CursorMode.Manipulate => InfoOverlayFlags.VerbManipulate, CursorMode.Talk => InfoOverlayFlags.VerbTalk, CursorMode.Take => InfoOverlayFlags.VerbTake, _ => 0 });
public MapAnnotationLayer(LogicalMap2D logicalMap, Vector2 tileSize) { _logicalMap = logicalMap ?? throw new ArgumentNullException(nameof(logicalMap)); _tileSize = tileSize; _logicalMap.Dirty += (sender, args) => _dirty.Add((args.X, args.Y)); // _drawLayer = DrawLayer.Diagnostic; On <RenderEvent>(e => Render()); }
public IMapLayer CreateMapLayer( LogicalMap2D logicalMap, ITexture tileset, Func <int, TileData> getTileFunc, DrawLayer layer, IconChangeType iconChangeType) { return(new MapLayer(logicalMap, tileset, getTileFunc, layer, iconChangeType)); }
public MapRenderable2D(LogicalMap2D logicalMap, ITexture tileset, IGameFactory factory) { if (tileset == null) { throw new ArgumentNullException(nameof(tileset)); } if (factory == null) { throw new ArgumentNullException(nameof(factory)); } _logicalMap = logicalMap ?? throw new ArgumentNullException(nameof(logicalMap)); var subImage = tileset.Regions[0]; TileSize = subImage.Size; _underlay = AttachChild(factory.CreateMapLayer( logicalMap, tileset, logicalMap.GetUnderlay, DrawLayer.Underlay, IconChangeType.Underlay)); _overlay = AttachChild(factory.CreateMapLayer(logicalMap, tileset, logicalMap.GetOverlay, DrawLayer.Overlay, IconChangeType.Overlay)); _info = AttachChild(new InfoOverlay(logicalMap)); var tileSize = tileset.Regions[0].Size; _annotations = AttachChild(new MapAnnotationLayer(logicalMap, tileSize)); On <ToggleUnderlayEvent>(e => _underlay.IsActive = !_underlay.IsActive); On <ToggleOverlayEvent>(e => _overlay.IsActive = !_overlay.IsActive); }
public IMapLayer CreateMapLayer(LogicalMap2D logicalMap, ITexture tileset, Func <int, TileData> getTileFunc, DrawLayer layer, IconChangeType iconChangeType) { throw new NotImplementedException(); }
public Collider2D(LogicalMap2D logicalMap, bool isLargeMap) { _logicalMap = logicalMap ?? throw new ArgumentNullException(nameof(logicalMap)); _isLargeMap = isLargeMap; }