protected override void OnMouseDown(MouseEventArgs e) { if (_map != null) { if (MapPanelClicked != null) { var p = ConvertCoordsDiamond(e.X, e.Y); if (p.Y >= 0 && p.Y < _map.MapSize.Rows && p.X >= 0 && p.X < _map.MapSize.Cols) { var tile = _map[p.Y, p.X]; if (tile != null) { ClickPoint = p; _map.SelectedTile = new MapLocation( ClickPoint.Y, ClickPoint.X, _map.CurrentHeight); MapViewPanel.Instance.MapView.SetDrag(p, p); var mpe = new MapPanelClickEventArgs(); mpe.ClickTile = tile; mpe.MouseEventArgs = e; mpe.ClickLocation = new MapLocation( ClickPoint.Y, ClickPoint.X, _map.CurrentHeight); MapPanelClicked(this, mpe); } else { return; } } } Refresh(); } }
private void RmpPanel_PanelClick(object sender, MapPanelClickEventArgs e) { _rmpPanel.Focus(); idxLabel.Text = Text; try { if (_currEntry != null && e.MouseEventArgs.Button == MouseButtons.Right) { RmpEntry selEntry = ((XCMapTile)e.ClickTile).Rmp; if (selEntry != null) { ConnectNodes(selEntry); _currEntry = selEntry; FillGui(); Refresh(); _map.MapChanged = true; return; } } var prevEntry = _currEntry; _currEntry = ((XCMapTile)e.ClickTile).Rmp; if (_currEntry == null && e.MouseEventArgs.Button == MouseButtons.Right) { _currEntry = _map.AddRmp(e.ClickLocation); ConnectNewNode(prevEntry); _map.MapChanged = true; } } catch { return; } FillGui(); }