示例#1
0
        /// <summary>
        /// Executes at game over.
        /// Count scores.
        /// </summary>
        /// <param name="playerScores">Player scores</param>
        /// <param name="aiScores">AI scores</param>
        private void _scoring_GameOver(int playerScores, int aiScores)
        {
            _gameStarted = false;
            //Thread.Sleep(500);
            var message = "";
            var playerWin = playerScores > aiScores;
            if (playerWin)
            {
                message += "You win :)";
            }
            else
            {
                message += "You lose :(";
            }
            message += "\n";
            message += String.Format("{0} : {1}",playerScores, aiScores);
            pickButton.IsEnabled = false;

            Thread thread = new Thread(new ParameterizedThreadStart(GameOverMessage));
            thread.Start(message);

            _dbconnector.Add(nick, playerWin);
            var gameHistoryWindow = new GameHistoryWindow();
            gameHistoryWindow.dataGrid.ItemsSource = _dbconnector.GetHistory();
            gameHistoryWindow.Show();
        }