private void Map_FogOrMarkerChanged(GameMap map) { UpdateGridBrush(); }
protected override void OnRender(DrawingContext drawingContext) { base.OnRender(drawingContext); GameMap map = (GameMap)DataContext; if (map != null) { Brush b = new SolidColorBrush(PlayerMode?Color.FromArgb(255, 0, 0, 0):Color.FromArgb(128, 0, 0, 0)); Rect drawRect = OriginRect(); Rect rectStart = new Rect(); bool running = false; for (int y = 0; y < map.CellsHeight; y++) { Action drawIfRunning = () => { if (running) { running = false; rectStart.Width = drawRect.X - rectStart.X; Rect finalRect = rectStart; if (playerMode) { double extra = finalRect.Height * .01; finalRect.Y -= extra; finalRect.Height += extra * 2.0; } drawingContext.DrawRectangle(b, null, finalRect); } }; for (int x = 0; x < map.CellsWidth; x++) { if (map[x, y]) { if (!running) { rectStart = drawRect; running = true; } } else { drawIfRunning(); } drawRect.X += drawRect.Width; } drawIfRunning(); drawRect.X = UseGridOrigin.X; drawRect.Y += drawRect.Height; } foreach (KeyValuePair <int, List <GameMap.Marker> > pair in map.Markers) { foreach (GameMap.Marker m in pair.Value) { DrawMarker(drawingContext, pair.Key, m); } } } }
public void RemoveMap(MapStub stub) { DeleteMapFile(stub); Maps.Remove(stub); GameMap.Delete(stub.Id); }