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_Map_MouseMove(object sender, MouseEventArgs e)
        {
            if (isMovingMap)
            {
                drawOffsetX = lastOffsetX + (e.X - mouseStartX);
                drawOffsetY = lastOffsetY + (e.Y - mouseStartY);

                // ToDo: Prevent scrolling out of bounds here.

                UI_Map.Invalidate();
            }
        }
Beispiel #3
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 #4
0
        private void UI_Map_MouseDown(object sender, MouseEventArgs e)
        {
            if (Control.ModifierKeys.HasFlag(Keys.Shift))
            {
                int pointX = e.Location.X - drawOffsetX;
                int pointY = e.Location.Y - drawOffsetY;

                pointX -= pointX % 256;
                pointY -= pointY % 256;

                overlay.ToggleOverlay(new Point(pointX, pointY));
                UI_Map.Invalidate();
            }
            else
            {
                isMovingMap = true;
                mouseStartX = e.X;
                mouseStartY = e.Y;
            }
        }
Beispiel #5
0
 private void MapViewerWindow_ResizeEnd(object sender, EventArgs e)
 {
     UI_Map.Invalidate();
 }