private void JoinGame() { StopTimer(); CurrentGameMode gameMode = this.CurrentGameModes.CurrentItem as CurrentGameMode; _service.SetCurrentGameMode(gameMode); if (_connexion.AddPlayerToGame(gameMode.Id, _service.GetCurrentPlayer().Id)) { _eventAggregator.GetEvent <ChangeViewMainRegionEvent>().Publish(ViewNames.MainViewGame); } else { _eventAggregator.GetEvent <ChangeViewMainRegionEvent>().Publish(ViewNames.AttenteMenu); } }
private void MousePressed(MouseButtonEventArgs e) { Zone = _zoneService.InitializeZone(_connexion, _informationService.GetCurrentGameMode().Id); OnPropertyChanged(nameof(Zone)); Point pos = e.GetPosition(null); double height = ((MainViewGame)e.Source).Height; double width = ((MainViewGame)e.Source).Width; height -= height * Scale; width -= width * Scale; height /= 2; width /= 2; _connexion.Switch((int)((pos.X - width - CenterX * Scale) / (10 * Scale)), (int)((pos.Y - height - CenterY * Scale) / (10 * Scale)), _informationService.GetCurrentPlayer().Id, _informationService.GetCurrentGameMode().Id); }