Exemplo n.º 1
0
        protected virtual void NewGame(GameState state = null)
        {
            GameViewModel gvm = _viewModelChanger?.GetViewModelByName("Game") as GameViewModel;

            gvm?.StartGame(state);
            _viewModelChanger?.ChangeCurrentViewModel("Game");
        }
Exemplo n.º 2
0
 public virtual void BackToMenu()
 {
     if (_savedGame || (MessageBoxResult.Yes == MessageBox.Show("Jeśli przejdziesz do menu stracisz niezapisany postęp gry. Czy na pewno chcesz powrócić do menu?" +
                                                                "", "Uwaga", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)))
     {
         _viewModelChanger?.ChangeCurrentViewModel("StartMenu");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Switches to the EndGame view.
        /// </summary>
        public virtual void OnGameEnded()
        {
            GameEngine.Timer.Stop();
            GameEngine.EnemyMovementManager.Stop();
            TimeSpan time             = GameEngine.Timer.TimeLeft;
            var      endGameViewModel = _viewModelChanger.GetViewModelByName("EndGame") as EndGameViewModel;

            if (endGameViewModel == null)
            {
                throw new InvalidOperationException();
            }
            endGameViewModel.Points   = GameEngine.Points;
            endGameViewModel.GameTime = time;
            _viewModelChanger?.ChangeCurrentViewModel("EndGame");
        }
Exemplo n.º 4
0
 protected virtual void ShowHighscores()
 {
     _viewModelChanger.ChangeCurrentViewModel("Highscores");
 }
Exemplo n.º 5
0
 public virtual void Pause()
 {
     GameEngine.Timer.Stop();
     GameEngine?.EnemyMovementManager?.Stop();
     _viewModelChanger.ChangeCurrentViewModel("Pause");
 }