Exemplo n.º 1
0
        //Event handler for the new game button.
        private void btnNewGame_Click(object sender, EventArgs e)
        {
            //Sets game state for this game.
            GameState = 1;
            //Resets the game variables back to default.
            HumanWins    = 0;
            CompWins     = 0;
            Ties         = 0;
            ChoiceOne    = 0;
            ChoiceTwo    = 0;
            CompChoice   = "";
            CurrentClick = 0;
            //Resets the results label
            lblResults.Text = "";
            //Generates a new random for the new game set.
            CurrentRand = randChoice.Next(3);
            //Resets the win loss ratio for the new game.
            lblRatio.Text = "Wins: " + HumanWins + " Losses: " + CompWins + " Ties: " + Ties;
            //Hides this form.
            this.Visible = false;
            //Statement to recheck game type.
            //Creates a new instance of gametype form.
            LoadGameType GameType = new LoadGameType();

            //Shows the form.
            GameType.ShowDialog();
            //Shows the form again.
            this.Visible = true;
        }
Exemplo n.º 2
0
        //Form load event.
        private void Final_Load(object sender, EventArgs e)
        {
            //Creates a new instance of gametype form.
            LoadGameType GameType = new LoadGameType();

            //Shows the form.
            GameType.ShowDialog();
            //Hides this form.
            this.Visible = false;
            //Clears the results label on load.
            lblResults.Text = "";
            //Sets the random for the first round of the first game.
            CurrentRand = randChoice.Next(3);
            //Sets gamestate for initial round.
            GameState = 1;
        }