Exemplo n.º 1
0
 //Update the player according if user has guessed correctly or run out of tries
 private void UpdatePlayerScore(bool isAWin)
 {
     //Using discard because an if statement was not as clear as this
     _ = isAWin == true? (actualPlayer.Score["Wins"] += 1) : (actualPlayer.Score["Loses"] += 1);
     //Then update the board.
     gameScoreText.Text = UpdateScore.updatePlayerScore(actualPlayer);
 }
Exemplo n.º 2
0
        private void startGameButton_Click(object sender, RoutedEventArgs e)
        {
            //Iniciar dialogo para preguntar el nombre
            MyInputBox ingresaNombre = new MyInputBox(actualPlayer);

            ingresaNombre.ShowDialog();
            if (actualPlayer.Name != null)
            {
                //Inicializar jugador y bloquear creacion de nuevo jugador
                playerName.Text           = actualPlayer.Name;
                playerName.Foreground     = new SolidColorBrush(Colors.BlueViolet);
                startGameButton.IsEnabled = false;
                gameScoreText.Text        = UpdateScore.updatePlayerScore(actualPlayer);
                gameStageSelection(1);
            }
        }