Beispiel #1
0
        private void OnMinimapTileDone(object sender, EventArgs e)
        {
            MinimapTileReadyArgs args = (MinimapTileReadyArgs)e;

            // Ensure we're using the correct runner.
            if (args.RunnerIndex != buildRunnerIndex)
                return;

            if (canvas == null)
            {
                int sizeX = (args.Bounds.HighX - args.Bounds.LowX) + 1;
                int sizeY = (args.Bounds.HighY - args.Bounds.LowY) + 1;

                canvas = new MapCanvas(sizeX, sizeY);
            }

            int posX = (args.Position.X - args.Bounds.LowX) * 256;
            int posY = (args.Position.Y - args.Bounds.LowY) * 256;

            canvas.DrawToCanvas(args.Image, posX, posY);
            UI_Map.Invalidate();

            tileDone++;
            if (tileTotal > tileDone)
            {
                UI_TileDisplay.Text = string.Format(Constants.MAP_VIEWER_TILE_STATUS, tileDone, tileTotal);
            }
            else
            {
                UI_TileDisplay.Hide();
                UI_ExportTip.Show();
            }
        }
Beispiel #2
0
        private void UI_FileList_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode selected = UI_FileList.SelectedNode;

            if (selected != null)
            {
                // Clean up previous excursions.
                TerminateRunners(); // Terminate runners that be running.

                if (canvas != null)
                    canvas.Dispose();

                canvas = null;
                overlay.ClearPoints();

                UI_PreviewStatus.Hide();
                UI_Map.Invalidate();

                UI_ExportButton.Enabled = true;
                UI_ExportImageButton.Enabled = true;

                drawOffsetX = lastOffsetX = 0;
                drawOffsetY = lastOffsetY = 0;

                // Detatch mouse control (this shouldn't ever be an issue, really).
                isMovingMap = false;

                string mapName = selected.Text;
                selectedMapName = mapName;

                tileTotal = maps[mapName].Count;
                tileDone = 0;
                UI_TileDisplay.Text = string.Format(Constants.MAP_VIEWER_TILE_STATUS, 0, 0);
                UI_TileDisplay.Show();
                UI_ExportTip.Hide();

                buildRunner = new RunnerBuildMinimap(maps[mapName].ToArray());
                buildRunnerIndex = buildRunner.Index;
                buildRunner.Begin();
            }
        }
Beispiel #3
0
 public RunnerExport2DMap(string fileName, MapCanvas canvas)
 {
     this.canvas = canvas;
     this.fileName = fileName;
 }