Esempio n. 1
0
        public void Draw(Graphics g, int offsetX, int offsetY, int width, int height, Overlay overlay)
        {
            Rectangle bounds = new Rectangle(0, 0, width, height);
            for (int x = 0; x < XSize; x++)
            {
                for (int y = 0; y < YSize; y++)
                {
                    MapCanvasTile tile = Images[x, y];

                    int tileX = (x * CanvasSize);
                    int tileY = (y * CanvasSize);
                    int drawX = tileX + offsetX;
                    int drawY = tileY + offsetY;

                    Point topLeft = new Point(drawX, drawY);
                    Point bottomLeft = new Point(drawX, drawY + CanvasSize);
                    Point topRight = new Point(drawX + CanvasSize, drawY);
                    Point bottomRight = new Point(drawX + CanvasSize, drawY + CanvasSize);

                    tile.Active = (bounds.Contains(topLeft) || bounds.Contains(bottomLeft) || bounds.Contains(topRight) || bounds.Contains(bottomRight));

                    if (tile.Active)
                    {
                        tile.Draw(g, (x * CanvasSize) + offsetX, (y * CanvasSize) + offsetY);

                        // Overlay
                        for (int tX = 0; tX < MaxTiles; tX++)
                        {
                            for (int tY = 0; tY < MaxTiles; tY++)
                            {
                                int ofsTileX = TileSize * tX;
                                int ofsTileY = TileSize * tY;

                                Point tilePoint = new Point(tileX + ofsTileX, tileY + ofsTileY);
                                if (overlay.ShouldDrawOverlay(tilePoint))
                                    g.DrawImage(overlay.Image, drawX + ofsTileX, drawY + ofsTileY);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public MapViewerWindow()
        {
            InitializeComponent();

            maps = new Dictionary<string, List<CASCFile>>();
            mapStartPoints = new Dictionary<string, Point>();
            overlay = new Overlay(256, 256);

            explorer = new Explorer(this, "^World\\Minimaps\\", null, UI_FilterTimer, null, null, new string[] { "blp" }, "MVT_N_{0}", true);
            explorer.ExploreHitCallback = OnExploreHit;
            explorer.ExploreDoneCallback = OnExploreDone;

            EventManager.MapExportDone += OnMapExportDone;
            EventManager.MapExportDone2D += OnMapExportDone2D;
            EventManager.CASCLoadStart += OnCASCLoadStart;
            EventManager.MinimapTileDone += OnMinimapTileDone;
            explorer.Initialize();

            exportCancelCallback = CancelExport;
            imageExportCancelCallback = Cancel2DExport;
        }