예제 #1
0
파일: Game.cs 프로젝트: ZonCen/CST
        private void CalculateWin()
        {
            if (scorePlayer1Game1 > scorePlayer2Game1 && scorePlayer1Game2 > scorePlayer2Game2)
            {
                player1.gameWon  += 2;
                player1.matchWon += 1;
            }
            else if (scorePlayer2Game1 > scorePlayer1Game1 && scorePlayer2Game2 > scorePlayer1Game2)
            {
                player2.gameWon  += 2;
                player2.matchWon += 1;
            }
            else if (scorePlayer1Game1 > scorePlayer2Game2 || scorePlayer1Game2 > scorePlayer2Game2)
            {
                player1.gameWon += 1;
                player2.gameWon += 1;
            }


            player1.pointDifference += (scorePlayer1Game1 - scorePlayer2Game1) + (scorePlayer1Game2 - scorePlayer2Game2);
            player2.pointDifference += (scorePlayer2Game1 - scorePlayer1Game1) + (scorePlayer2Game2 - scorePlayer1Game2);

            ExcelHandler updateScore = new ExcelHandler();

            updateScore.updateScore(player1, player2, scorePlayer1Game1, scorePlayer2Game1, scorePlayer1Game2, scorePlayer2Game2);
        }