Beispiel #1
0
        // Displaying the winner of the whole game and blocking any further actions on buttons
        private void DisplayGameWinner(string winner)
        {
            // Hiding all gesture buttons
            foreach (Button button in gestureButtons)
            {
                button.Hide();
            }

            // Hiding all gesture labels (texts under buttons)
            Lbl_Rock.Hide();
            Lbl_Paper.Hide();
            Lbl_Scissors.Hide();
            Lbl_Lizard.Hide();
            Lbl_Spock.Hide();

            // Changing 'Next Round' button colour to 'inactive'
            Btn_NxtRound.BackColor = SystemColors.ControlLight;

            // Showing the winning message
            Lbl_GameWinner.Show();

            // If the computer has won
            if (winner == "Computer")
            {
                // Changing the colours of the texts
                Lbl_PlayerScore.ForeColor   = Color.Red;
                Lbl_ComputerScore.ForeColor = Color.Green;
                Lbl_GameWinner.ForeColor    = Color.Red;
                Lbl_GameWinner.Text         = @"Computer wins! Try again ¯\_( ͡° ͜ʖ ͡°)_/¯";
            }
            else
            {
                // Changing the colours of the texts
                Lbl_PlayerScore.ForeColor   = Color.Green;
                Lbl_ComputerScore.ForeColor = Color.Red;
                Lbl_GameWinner.ForeColor    = Color.Green;
                Lbl_GameWinner.Text         = "Congratulations, " + playerName + "!\n" + @"You have won! ᕦ( ͡° ͜ʖ ͡°)ᕤ";
            }
        }