private void MainView_MouseUpView(object sender, MousePositionEventArgs e) { double deltaX = downX - e.X; double deltaY = downY - e.Y; if (deltaX == 0 && deltaY == 0) { return; } if (Math.Abs(deltaX) >= Math.Abs(deltaY)) { if (deltaX > 0) { _gameManager.MoveLeft(); } else { _gameManager.MoveRight(); } } else { if (deltaY > 0) { _gameManager.MoveUp(); } else { _gameManager.MoveDown(); } } DrawCellsOnView(_gameManager.Field); _mainView.CurrentScore = _gameManager.CurrentScore; _mainView.HighScore = _gameManager.HighScore; }
private void MainView_MouseDownView(object sender, MousePositionEventArgs e) { downX = e.X; downY = e.Y; }